Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/client/activation/node/languageServerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
import '../../common/extensions';

import { inject, injectable } from 'inversify';
import { Disposable, LanguageClient, LanguageClientOptions } from 'vscode-languageclient';
import {
DidChangeConfigurationNotification,
Disposable,
LanguageClient,
LanguageClientOptions
} from 'vscode-languageclient';

import { DeprecatePythonPath } from '../../common/experiments/groups';
import { traceDecorators, traceError } from '../../common/logger';
import { IConfigurationService, Resource } from '../../common/types';
import { IConfigurationService, IExperimentsManager, IInterpreterPathService, Resource } from '../../common/types';
import { createDeferred, Deferred, sleep } from '../../common/utils/async';
import { swallowExceptions } from '../../common/utils/decorators';
import { noop } from '../../common/utils/misc';
Expand All @@ -32,7 +38,9 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy {
@inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory,
@inject(ITestManagementService) private readonly testManager: ITestManagementService,
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
@inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService
@inject(ILanguageServerFolderService) private readonly folderService: ILanguageServerFolderService,
@inject(IExperimentsManager) private readonly experiments: IExperimentsManager,
@inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService
) {
this.startupCompleted = createDeferred<void>();
}
Expand Down Expand Up @@ -95,6 +103,20 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy {
const progressReporting = new ProgressReporting(this.languageClient!);
this.disposables.push(progressReporting);

if (this.experiments.inExperiment(DeprecatePythonPath.experiment)) {
this.disposables.push(
this.interpreterPathService.onDidChange(() => {
// Manually send didChangeConfiguration in order to get the server to requery
// the workspace configurations (to then pick up pythonPath set in the middleware).
// This is needed as interpreter changes via the interpreter path service happen
// outside of VS Code's settings (which would mean VS Code sends the config updates itself).
this.languageClient!.sendNotification(DidChangeConfigurationNotification.type, {
settings: null
});
})
);
}

const settings = this.configurationService.getSettings(resource);
if (settings.downloadLanguageServer) {
this.languageClient.onTelemetry((telemetryEvent) => {
Expand Down