diff --git a/news/2 Fixes/2281.md b/news/2 Fixes/2281.md new file mode 100644 index 000000000000..e4fb5ab10c06 --- /dev/null +++ b/news/2 Fixes/2281.md @@ -0,0 +1 @@ +Fix error when switching from new language server to the old `Jedi` language server. diff --git a/src/client/activation/languageServer.ts b/src/client/activation/languageServer.ts index 8c416206a7b1..0842d07e0ec0 100644 --- a/src/client/activation/languageServer.ts +++ b/src/client/activation/languageServer.ts @@ -87,7 +87,7 @@ export class LanguageServerExtensionActivator implements IExtensionActivator { this.surveyBanner = services.get(IPythonExtensionBanner, BANNER_NAME_LS_SURVEY); - (this.configuration.getSettings() as PythonSettings).addListener('change', this.onSettingsChanged); + (this.configuration.getSettings() as PythonSettings).addListener('change', this.onSettingsChanged.bind(this)); } public async activate(): Promise { @@ -112,7 +112,7 @@ export class LanguageServerExtensionActivator implements IExtensionActivator { for (const d of this.disposables) { d.dispose(); } - (this.configuration.getSettings() as PythonSettings).removeListener('change', this.onSettingsChanged); + (this.configuration.getSettings() as PythonSettings).removeListener('change', this.onSettingsChanged.bind(this)); } private async startLanguageServer(clientOptions: LanguageClientOptions): Promise { diff --git a/src/client/unittests/pytest/services/argsService.ts b/src/client/unittests/pytest/services/argsService.ts index e8942a840b9f..17775ec50d1c 100644 --- a/src/client/unittests/pytest/services/argsService.ts +++ b/src/client/unittests/pytest/services/argsService.ts @@ -32,7 +32,7 @@ const OptionsWithoutArguments = ['--cache-clear', '--cache-show', '--collect-in- '--no-print-logs', '--noconftest', '--old-summary', '--pdb', '--pyargs', '-PyTest, Unittest-pyargs', '--quiet', '--runxfail', '--setup-only', '--setup-plan', '--setup-show', '--showlocals', '--strict', '--trace-config', '--verbose', '--version', '-h', '-l', '-q', '-s', '-v', '-x', - '--boxed', '--forked', '--looponfail', '--tx', '-d']; + '--boxed', '--forked', '--looponfail', '--trace', '--tx', '-d']; @injectable() export class ArgumentsService implements IArgumentsService { @@ -92,7 +92,7 @@ export class ArgumentsService implements IArgumentsService { '-l', '--showlocals', '--no-print-logs', '--debug', - '--setup-only', '--setup-show', '--setup-plan' + '--setup-only', '--setup-show', '--setup-plan', '--trace' ]); optionsWithArgsToRemove.push(...[ '-m', '--maxfail', @@ -111,7 +111,7 @@ export class ArgumentsService implements IArgumentsService { } case TestFilter.debugAll: case TestFilter.runAll: { - optionsWithoutArgsToRemove.push('--collect-only'); + optionsWithoutArgsToRemove.push(...['--collect-only', '--trace']); break; } case TestFilter.debugSpecific: @@ -120,7 +120,8 @@ export class ArgumentsService implements IArgumentsService { '--collect-only', '--lf', '--last-failed', '--ff', '--failed-first', - '--nf', '--new-first' + '--nf', '--new-first', + '--trace' ]); optionsWithArgsToRemove.push(...[ '-k', '-m',