From 5c606ec17454a5a4a968f772eb2b4f785068e4fb Mon Sep 17 00:00:00 2001 From: almenon Date: Thu, 14 Nov 2024 22:54:25 -0800 Subject: [PATCH] upgrade vscode engine --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- src/env/application/types.ts | 2 +- src/env/application/workspace.ts | 2 +- test/mockVscode.spec.ts | 8 +++++++- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ecb0bf..b1ab814 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "devDependencies": { "@types/mocha": "^10.0.9", "@types/node": "^20.17.6", - "@types/vscode": "^1.36.0", + "@types/vscode": "^1.40.0", "@vscode/test-cli": "^0.0.10", "@vscode/test-electron": "^2.4.1", "mocha": "^10.8.2", @@ -25,7 +25,7 @@ "vscode-uri": "^2.1.2" }, "engines": { - "vscode": "^1.36.0" + "vscode": "^1.40.0" } }, "node_modules/@bcoe/v8-coverage": { @@ -356,9 +356,9 @@ } }, "node_modules/@types/vscode": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.39.0.tgz", - "integrity": "sha512-rlg0okXDt7NjAyHXbZ2nO1I/VY/8y9w67ltLRrOxXQ46ayvrYZavD4A6zpYrGbs2+ZOEQzcUs+QZOqcVGQIxXQ==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.95.0.tgz", + "integrity": "sha512-0LBD8TEiNbet3NvWsmn59zLzOFu/txSlGxnv5yAFHCrhG9WvAnR3IvfHzMOs2aeWqgvNjq9pO99IUw8d3n+unw==", "dev": true }, "node_modules/@vscode/extension-telemetry": { @@ -2731,9 +2731,9 @@ } }, "@types/vscode": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.39.0.tgz", - "integrity": "sha512-rlg0okXDt7NjAyHXbZ2nO1I/VY/8y9w67ltLRrOxXQ46ayvrYZavD4A6zpYrGbs2+ZOEQzcUs+QZOqcVGQIxXQ==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.95.0.tgz", + "integrity": "sha512-0LBD8TEiNbet3NvWsmn59zLzOFu/txSlGxnv5yAFHCrhG9WvAnR3IvfHzMOs2aeWqgvNjq9pO99IUw8d3n+unw==", "dev": true }, "@vscode/extension-telemetry": { diff --git a/package.json b/package.json index eea3225..58a6a36 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "version": "3.0.0", "publisher": "almenon", "engines": { - "vscode": "^1.36.0" + "vscode": "^1.40.0" }, "categories": [ "Other", @@ -281,7 +281,7 @@ "devDependencies": { "@types/mocha": "^10.0.9", "@types/node": "^20.17.6", - "@types/vscode": "^1.36.0", + "@types/vscode": "^1.40.0", "@vscode/test-cli": "^0.0.10", "@vscode/test-electron": "^2.4.1", "mocha": "^10.8.2", diff --git a/src/env/application/types.ts b/src/env/application/types.ts index 07f6e4f..ab91c82 100644 --- a/src/env/application/types.ts +++ b/src/env/application/types.ts @@ -32,7 +32,7 @@ export interface IWorkspaceService { * * @readonly */ - readonly workspaceFolders: WorkspaceFolder[] | undefined; + readonly workspaceFolders: readonly WorkspaceFolder[] | undefined; /** * An event that is emitted when a workspace folder is added or removed. diff --git a/src/env/application/workspace.ts b/src/env/application/workspace.ts index b763ccd..cd088c6 100644 --- a/src/env/application/workspace.ts +++ b/src/env/application/workspace.ts @@ -12,7 +12,7 @@ export class WorkspaceService implements IWorkspaceService { public get rootPath(): string | undefined { return Array.isArray(workspace.workspaceFolders) ? workspace.workspaceFolders[0].uri.fsPath : undefined; } - public get workspaceFolders(): WorkspaceFolder[] | undefined { + public get workspaceFolders(): readonly WorkspaceFolder[] | undefined { return workspace.workspaceFolders; } public get onDidChangeWorkspaceFolders(): Event { diff --git a/test/mockVscode.spec.ts b/test/mockVscode.spec.ts index 09b72a5..0ddf138 100644 --- a/test/mockVscode.spec.ts +++ b/test/mockVscode.spec.ts @@ -1,5 +1,5 @@ import { EOL } from "os"; -import {} from "vscode" +import { ThemeColor } from "vscode" import type { TextDocument, WorkspaceFolder, TextLine, Position, Range, StatusBarItem, Extension, TreeDataProvider, Command, TreeItemCollapsibleState } from "vscode" import { URI } from 'vscode-uri' @@ -35,6 +35,8 @@ export let vscodeMock = { * The absolute file path of the directory containing this extension. */ extensionPath: "", + + extensionUri: null, /** * `true` if the extension has been activated. @@ -155,6 +157,10 @@ export let vscodeMock = { }, createStatusBarItem: function(alignment?: number, priority?: number):StatusBarItem{ return { + id: "", + name: "", + accessibilityInformation: null, + backgroundColor: new ThemeColor("#00AA00"), alignment: 1, priority: 0, text: "",