Skip to content

Use a single language server instance when type set to Node #11315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2020

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Apr 21, 2020

This PR splits apart analysisOptions.ts into two implementations, switching between them depending on the language server type setting. It also makes the LS key a static string to ensure only a single instance is spawned.

This means that the LS can be started without any document selectors (eventually leading to handling of #5132), and only have a single instance to handle all workspaces at once.

Also, while moving this code, delete some ancient deprecated options which no recent LS has used.

While working on this, I discovered the reason for #5132 (comment); I'll file a new issue about that as it's out of scope for this PR.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@jakebailey jakebailey added the no-changelog No news entry required label Apr 21, 2020
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-io
Copy link

Codecov Report

Merging #11315 into master will increase coverage by 0.33%.
The diff coverage is 62.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11315      +/-   ##
==========================================
+ Coverage   61.12%   61.46%   +0.33%     
==========================================
  Files         601      606       +5     
  Lines       33128    33812     +684     
  Branches     4680     4790     +110     
==========================================
+ Hits        20249    20781     +532     
- Misses      11861    12579     +718     
+ Partials     1018      452     -566     
Impacted Files Coverage Δ
src/client/activation/node/manager.ts 27.77% <0.00%> (ø)
src/client/activation/activationService.ts 87.35% <50.00%> (-0.88%) ⬇️
src/client/activation/common/analysisOptions.ts 59.52% <59.52%> (ø)
...lient/activation/languageServer/analysisOptions.ts 59.59% <65.21%> (-0.57%) ⬇️
src/client/activation/node/analysisOptions.ts 71.42% <71.42%> (ø)
src/client/activation/serviceRegistry.ts 82.71% <75.00%> (-0.83%) ⬇️
src/client/activation/languageServer/manager.ts 83.87% <100.00%> (ø)
src/datascience-ui/react-common/arePathsSame.ts 75.00% <0.00%> (-12.50%) ⬇️
src/client/common/utils/platform.ts 64.70% <0.00%> (-11.77%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
... and 163 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df96afb...0909104. Read the comment docs.

const configurationService = this.serviceContainer.get<IConfigurationService>(IConfigurationService);
const serverType = configurationService.getSettings(this.resource).languageServer;
if (serverType === LanguageServerType.Node) {
return 'shared-ls';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures only a single instance is used.

import { ILanguageServerOutputChannel } from '../types';

@injectable()
export class NodeLanguageServerAnalysisOptions extends LanguageServerAnalysisOptionsBase {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty class; no options are needed to configure this other than the defaults.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jakebailey jakebailey merged commit 376d6b9 into microsoft:master Apr 22, 2020
@jakebailey jakebailey deleted the single-ls branch April 22, 2020 19:21
jakebailey added a commit to jakebailey/vscode-python that referenced this pull request Apr 26, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants