diff --git a/ChangeLog.md b/ChangeLog.md index 268caa03..a240bc6a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,7 @@ # Write Your Python Program - CHANGELOG +* 2.0.9 (2025-10-27) + * Overwrite path to old plugin versions #188 * 2.0.8 (2025-10-16) * Fix vscode warning for literals * Fix highlighting for files with umlauts diff --git a/package.json b/package.json index 31c7707b..ce449656 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Write Your Python Program!", "description": "A user friendly python environment for beginners", "license": "See license in LICENSE", - "version": "2.0.8", + "version": "2.0.9", "publisher": "StefanWehr", "icon": "icon.png", "engines": { diff --git a/python/.vscode/settings.json b/python/.vscode/settings.json index 1e488efe..8b45edc3 100644 --- a/python/.vscode/settings.json +++ b/python/.vscode/settings.json @@ -1,6 +1,10 @@ { "python.analysis.diagnosticMode": "workspace", - "python.autoComplete.extraPaths": [ - "/Users/swehr/.vscode/extensions/stefanwehr.write-your-python-program-1.3.2/python/src/" - ] + "python.analysis.diagnosticSeverityOverrides": { + "reportWildcardImportFromLibrary": "none" + }, + "python.analysis.extraPaths": [ + "/Users/swehr/.vscode/extensions/stefanwehr.write-your-python-program-2.0.7/python/code/" + ], + "python.analysis.typeCheckingMode": "off" } diff --git a/src/extension.ts b/src/extension.ts index 14963754..f06ec855 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -239,7 +239,8 @@ async function fixPylanceConfig( // turn typechecking off // This is a quite distructive change, so we do it on first hit of the run button // not on-load of the plugin - const libDir = context.asAbsolutePath('python/code/'); + const subDir = 'python/code'; + const libDir = context.asAbsolutePath(subDir); const cfg = vscode.workspace.getConfiguration('python', folder?.uri); const target = folder ? vscode.ConfigurationTarget.WorkspaceFolder @@ -283,9 +284,17 @@ async function fixPylanceConfig( // extraPaths const keyExtraPaths = 'analysis.extraPaths'; const extra = cfg.get(keyExtraPaths) ?? []; - if (!extra.includes(libDir)) { - const newExtra = [...extra, libDir]; + // Filter out old plugin paths (paths containing 'write-your-python-program' but not matching current libDir) + const filtered = extra.filter(p => { + const isPluginPath = p.includes('stefanwehr.write-your-python-program') && p.includes(subDir); + return !isPluginPath; + }); + if (!filtered.includes(libDir)) { + const newExtra = [...filtered, libDir]; await tryUpdate(keyExtraPaths, newExtra); + } else if (filtered.length !== extra.length) { + // libDir is already present but we removed old paths, so update anyway + await tryUpdate(keyExtraPaths, filtered); } // typechecking off