Skip to content

Do not restart LS for Pylance on interpreter change #19121

@karrtikr

Description

@karrtikr

Restarting the language server results in creating a new node/python process, or a new worker in web scenario. All commands have to be correctly deregistered when the old language server is disposed.

  • It seems Pylance client already handles interpreter changes, so this can be skipped. cc/ @heejaechang
  • For Jedi, AFAICS we're currently not consuming this notification
    this.interpreterPathService.onDidChange(() => {
    // Manually send didChangeConfiguration in order to get the server to re-query
    // 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,
    });
    }),

This will also lead in some code simplification in src\client\languageServer\watcher.ts.

Metadata

Metadata

Assignees

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.debtCovers everything internal: CI, testing, refactoring of the codebase, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions