From 1bff58dfd26dbc9e4a97fc39738afc29f67cee38 Mon Sep 17 00:00:00 2001 From: Justin Wagner Date: Sat, 13 May 2023 13:13:23 -0600 Subject: [PATCH 1/5] Only update desired key in `python.analysis.diagnosticSeverityOverrides` This should ensure that only the config key we care about is updated, and not every other config that the user has set. As mentioned in https://github.com/joedevivo/vscode-circuitpython/issues/105 --- src/extension.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index b44ba4b..9aa3d9a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,10 +5,11 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.getConfiguration().update("python.languageServer", "Pylance"); vscode.workspace.getConfiguration().update("python.linting.pylintEnabled", false); - vscode.workspace.getConfiguration().update("python.analysis.diagnosticSeverityOverrides", - { - "reportMissingModuleSource": "none" - } + let config_key = "python.analysis.diagnosticSeverityOverrides" + let current_value = vscode.workspace.getConfiguration()[config_key]; + current_value["reportMissingModuleSource"] = "none" + vscode.workspace.getConfiguration().update(config_key, + current_value ); let container: Container = await Container.newInstance(context); } From ba8ae07552df20e943125a8117fc868e8b427fff Mon Sep 17 00:00:00 2001 From: Justin Wagner Date: Sat, 13 May 2023 13:20:11 -0600 Subject: [PATCH 2/5] Formatting fixes --- src/extension.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 9aa3d9a..ffc95d9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,11 +6,9 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.getConfiguration().update("python.linting.pylintEnabled", false); let config_key = "python.analysis.diagnosticSeverityOverrides" - let current_value = vscode.workspace.getConfiguration()[config_key]; + let current_value = vscode.workspace.getConfiguration()[config_key]; current_value["reportMissingModuleSource"] = "none" - vscode.workspace.getConfiguration().update(config_key, - current_value - ); + vscode.workspace.getConfiguration().update(config_key,current_value); let container: Container = await Container.newInstance(context); } From 4e58b7c9ef3f5fdb571907b6d7b2dd1c303f4430 Mon Sep 17 00:00:00 2001 From: Justin Wagner Date: Sat, 13 May 2023 13:53:02 -0600 Subject: [PATCH 3/5] Add missing semi-colon --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index ffc95d9..4ab72a8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,7 +7,7 @@ export async function activate(context: vscode.ExtensionContext) { let config_key = "python.analysis.diagnosticSeverityOverrides" let current_value = vscode.workspace.getConfiguration()[config_key]; - current_value["reportMissingModuleSource"] = "none" + current_value["reportMissingModuleSource"] = "none"; vscode.workspace.getConfiguration().update(config_key,current_value); let container: Container = await Container.newInstance(context); } From 79bb682196700a575726bf8c2ce1f5ca4f00325e Mon Sep 17 00:00:00 2001 From: Justin Wagner Date: Sat, 13 May 2023 13:54:28 -0600 Subject: [PATCH 4/5] Improved variable names --- src/extension.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 4ab72a8..9801132 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,9 +6,9 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.getConfiguration().update("python.linting.pylintEnabled", false); let config_key = "python.analysis.diagnosticSeverityOverrides" - let current_value = vscode.workspace.getConfiguration()[config_key]; - current_value["reportMissingModuleSource"] = "none"; - vscode.workspace.getConfiguration().update(config_key,current_value); + let config_value = vscode.workspace.getConfiguration()[config_key]; + config_value["reportMissingModuleSource"] = "none"; + vscode.workspace.getConfiguration().update(config_key,config_value); let container: Container = await Container.newInstance(context); } From 4dbccdebd256eefd18aebab27ec4df3071fcf9bd Mon Sep 17 00:00:00 2001 From: Justin Wagner Date: Sat, 13 May 2023 14:00:46 -0600 Subject: [PATCH 5/5] Mimic syntax in other parts of repo --- src/extension.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 9801132..545f01a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,10 +5,9 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.getConfiguration().update("python.languageServer", "Pylance"); vscode.workspace.getConfiguration().update("python.linting.pylintEnabled", false); - let config_key = "python.analysis.diagnosticSeverityOverrides" - let config_value = vscode.workspace.getConfiguration()[config_key]; - config_value["reportMissingModuleSource"] = "none"; - vscode.workspace.getConfiguration().update(config_key,config_value); + let config_key: string = "python.analysis.diagnosticSeverityOverrides" + let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(config_key); + config.update("reportMissingModuleSource", "none"); let container: Container = await Container.newInstance(context); }