From c7fce40ad0a2c464e2abba0d184600c1852ceaee Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Thu, 9 Sep 2021 13:43:21 -0700 Subject: [PATCH 1/2] Fix for cached debug configuration (#17354) --- news/2 Fixes/17353.md | 1 + .../debugConfigurationService.ts | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 news/2 Fixes/17353.md diff --git a/news/2 Fixes/17353.md b/news/2 Fixes/17353.md new file mode 100644 index 000000000000..c2b98d4fa6dc --- /dev/null +++ b/news/2 Fixes/17353.md @@ -0,0 +1 @@ +Fix for debug configuration used when no launch.json exists is still used after launch.json is created. diff --git a/src/client/debugger/extension/configuration/debugConfigurationService.ts b/src/client/debugger/extension/configuration/debugConfigurationService.ts index 11f1b6416891..56fe0746e887 100644 --- a/src/client/debugger/extension/configuration/debugConfigurationService.ts +++ b/src/client/debugger/extension/configuration/debugConfigurationService.ts @@ -80,18 +80,19 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi // editor context where it was triggered. throw Error('This configuration can only be used as defined by `purpose`.'); } else { - if ((await this.experiments.inExperiment(CacheDebugConfig.experiment)) && this.cacheDebugConfig) { - debugConfiguration = cloneDeep(this.cacheDebugConfig); - } if (Object.keys(debugConfiguration).length === 0) { - const configs = await this.provideDebugConfigurations(folder, token); - if (configs === undefined) { - return; - } - if (Array.isArray(configs) && configs.length === 1) { - debugConfiguration = configs[0]; + if ((await this.experiments.inExperiment(CacheDebugConfig.experiment)) && this.cacheDebugConfig) { + debugConfiguration = cloneDeep(this.cacheDebugConfig); + } else { + const configs = await this.provideDebugConfigurations(folder, token); + if (configs === undefined) { + return; + } + if (Array.isArray(configs) && configs.length === 1) { + debugConfiguration = configs[0]; + } + this.cacheDebugConfig = cloneDeep(debugConfiguration); } - this.cacheDebugConfig = cloneDeep(debugConfiguration); } return this.launchResolver.resolveDebugConfiguration( folder, From 89b3630195967464e6f8aadccad7aae1295978a9 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Thu, 9 Sep 2021 13:47:35 -0700 Subject: [PATCH 2/2] Update change log for cherry pick --- CHANGELOG.md | 6 ++++-- news/2 Fixes/17353.md | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 news/2 Fixes/17353.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ddca481e8d29..3867fcdbfada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,16 @@ ### Fixes +1. Fix for debug configuration used when no launch.json exists is still used after launch.json is created. + ([#17353](https://github.com/Microsoft/vscode-python/issues/17353)) 1. Ensure default python executable to use is 'python' instead of ''. ([#17089](https://github.com/Microsoft/vscode-python/issues/17089)) 1. Ensure workspace interpreters are discovered and watched when in `pythonDiscoveryModuleWithoutWatcher` experiment. ([#17144](https://github.com/Microsoft/vscode-python/issues/17144)) 1. Do path comparisons appropriately in the new discovery component. ([#17244](https://github.com/Microsoft/vscode-python/issues/17244)) +1. Fix for test result not found for files starting with py. + ([#17270](https://github.com/Microsoft/vscode-python/issues/17270)) 1. Fix for unable to import when running unittest. ([#17280](https://github.com/Microsoft/vscode-python/issues/17280)) 1. Fix for multiple folders in `pytest` args. @@ -26,8 +30,6 @@ ([#17309](https://github.com/Microsoft/vscode-python/issues/17309)) 1. For CI ensure `tensorboard` is installed in python 3 environments only. ([#17325](https://github.com/Microsoft/vscode-python/issues/17325)) -1. Fix for test result not found for files starting with py. - ([#17270](https://github.com/Microsoft/vscode-python/issues/17270)) ### Thanks diff --git a/news/2 Fixes/17353.md b/news/2 Fixes/17353.md deleted file mode 100644 index c2b98d4fa6dc..000000000000 --- a/news/2 Fixes/17353.md +++ /dev/null @@ -1 +0,0 @@ -Fix for debug configuration used when no launch.json exists is still used after launch.json is created.