From aa60b7e7e92bccb7549ccbd5140a865842f18530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Kiraa=20Op=C3=A1len=C3=BD?= Date: Tue, 3 Sep 2024 23:57:13 +0200 Subject: [PATCH] addon_folders.ts: assign scheme to URIs created for mockups (#147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix path read from setting `blender.addonFolders` when the path pointed to non-system drive on Windows. * use vscode.Uri.from to load file to handle the path with schema correctly * update dependencies --------- Co-authored-by: Kiraa Co-authored-by: Mateusz GrzeliƄski --- CHANGELOG.md | 4 +++- package.json | 9 ++++----- src/addon_folder.ts | 9 ++++----- src/utils.ts | 2 +- tsconfig.json | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53afcc4..f912d16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ - Remove duplicate links to development (VSCode) directory (#172) - Remove broken links in addon and extension dir (#172) -### Changed +### Changed +- Updated dependencies. Now oldest supported VS Code version is `1.28.0` - version from September 2018. ([#147](https://github.com/JacquesLucke/blender_vscode/pull/147)) - Addon_update operator: Check more precisely which module to delete (#175) - Formatted all python code with `black -l 120` (#167) - Fix most of the user reported permission denied errors by changing python packages directory ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177)): @@ -25,6 +26,7 @@ - setting `blender.allowModifyExternalPython` is now deprecated ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177)) ### Fixed +- Path to addon indicated by [`blender.addonFolders`](vscode://settings/blender.addonFolders) now works correctly for non-system drive (usually `C:`) on Windows ([#147](https://github.com/JacquesLucke/blender_vscode/pull/147)) - Pinned requests to version 2.29 to maintain compatibility with blender 2.80 ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177)) - Find correct python path for blender 2.92 and before (#174). This partly fixes compatibility with blender 2.80. - "Blender: Run Script" will no longer open read-only file when hitting debug point (#142) diff --git a/package.json b/package.json index d4b92d2..5b407fe 100644 --- a/package.json +++ b/package.json @@ -266,16 +266,15 @@ "scripts": { "vscode:prepublish": "npm run compile", "compile": "tsc -p ./", - "watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install" + "watch": "tsc -watch -p ./" }, "devDependencies": { "@types/mocha": "^2.2.42", "@types/node": "^8.10.25", "@types/request": "^2.48.1", + "@types/vscode": "^1.28.0", "tslint": "^5.8.0", - "typescript": "^3.5.1", - "vscode": "^1.1.21" + "typescript": "^5.5.2" }, "dependencies": { "request": "^2.87.0" @@ -284,4 +283,4 @@ "ms-python.python", "ms-vscode.cpptools" ] -} +} \ No newline at end of file diff --git a/src/addon_folder.ts b/src/addon_folder.ts index 0f113f7..ddde617 100644 --- a/src/addon_folder.ts +++ b/src/addon_folder.ts @@ -20,12 +20,11 @@ export class AddonWorkspaceFolder { // search workspace folders instead. let addonFolders = await foldersToWorkspaceFoldersMockup( getConfig().get('addonFolders')); - if (addonFolders.length === 0) { - addonFolders = getWorkspaceFolders(); - } + + let searchableFolders = addonFolders.length !== 0 ? addonFolders : getWorkspaceFolders(); let folders = []; - for (let folder of addonFolders) { + for (let folder of searchableFolders) { let addon = new AddonWorkspaceFolder(folder); if (await addon.hasAddonEntryPoint()) { folders.push(addon); @@ -166,7 +165,7 @@ async function foldersToWorkspaceFoldersMockup(folders: string[]) { mockups.push({ "name" : path.basename(absolutePath), - "uri": vscode.Uri.parse(absolutePath), + "uri": vscode.Uri.from({ scheme: "file", path: absolutePath }), "index": i }); } diff --git a/src/utils.ts b/src/utils.ts index b69f745..3b64239 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -46,7 +46,7 @@ export function handleErrors(func: () => Promise) { try { await func(); } - catch (err) { + catch (err: any) { if (err instanceof Error) { if (err.message !== CANCEL) { vscode.window.showErrorMessage(err.message); diff --git a/tsconfig.json b/tsconfig.json index 137084f..3210eca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "target": "ES2020", "outDir": "out", "lib": [ - "es6" + "es2020" ], "sourceMap": true, "rootDir": "src",