Skip to content

Commit d03404b

Browse files
authored
Merge pull request #189 from skogsbaer/sw/fixes-2025-10-27
Fixes 2025-10-27
2 parents bf9467d + 2e15976 commit d03404b

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Write Your Python Program - CHANGELOG
22

3+
* 2.0.9 (2025-10-27)
4+
* Overwrite path to old plugin versions #188
35
* 2.0.8 (2025-10-16)
46
* Fix vscode warning for literals
57
* Fix highlighting for files with umlauts

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Write Your Python Program!",
44
"description": "A user friendly python environment for beginners",
55
"license": "See license in LICENSE",
6-
"version": "2.0.8",
6+
"version": "2.0.9",
77
"publisher": "StefanWehr",
88
"icon": "icon.png",
99
"engines": {

python/.vscode/settings.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"python.analysis.diagnosticMode": "workspace",
3-
"python.autoComplete.extraPaths": [
4-
"/Users/swehr/.vscode/extensions/stefanwehr.write-your-python-program-1.3.2/python/src/"
5-
]
3+
"python.analysis.diagnosticSeverityOverrides": {
4+
"reportWildcardImportFromLibrary": "none"
5+
},
6+
"python.analysis.extraPaths": [
7+
"/Users/swehr/.vscode/extensions/stefanwehr.write-your-python-program-2.0.7/python/code/"
8+
],
9+
"python.analysis.typeCheckingMode": "off"
610
}

src/extension.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ async function fixPylanceConfig(
239239
// turn typechecking off
240240
// This is a quite distructive change, so we do it on first hit of the run button
241241
// not on-load of the plugin
242-
const libDir = context.asAbsolutePath('python/code/');
242+
const subDir = 'python/code';
243+
const libDir = context.asAbsolutePath(subDir);
243244

244245
const cfg = vscode.workspace.getConfiguration('python', folder?.uri);
245246
const target = folder ? vscode.ConfigurationTarget.WorkspaceFolder
@@ -283,9 +284,17 @@ async function fixPylanceConfig(
283284
// extraPaths
284285
const keyExtraPaths = 'analysis.extraPaths';
285286
const extra = cfg.get<string[]>(keyExtraPaths) ?? [];
286-
if (!extra.includes(libDir)) {
287-
const newExtra = [...extra, libDir];
287+
// Filter out old plugin paths (paths containing 'write-your-python-program' but not matching current libDir)
288+
const filtered = extra.filter(p => {
289+
const isPluginPath = p.includes('stefanwehr.write-your-python-program') && p.includes(subDir);
290+
return !isPluginPath;
291+
});
292+
if (!filtered.includes(libDir)) {
293+
const newExtra = [...filtered, libDir];
288294
await tryUpdate(keyExtraPaths, newExtra);
295+
} else if (filtered.length !== extra.length) {
296+
// libDir is already present but we removed old paths, so update anyway
297+
await tryUpdate(keyExtraPaths, filtered);
289298
}
290299

291300
// typechecking off

0 commit comments

Comments
 (0)