Skip to content

Only activate language servers when running in virtual workspaces#17519

Merged
karrtikr merged 18 commits into
microsoft:mainfrom
karrtikr:pylancevirtualt
Nov 16, 2021
Merged

Only activate language servers when running in virtual workspaces#17519
karrtikr merged 18 commits into
microsoft:mainfrom
karrtikr:pylancevirtualt

Conversation

@karrtikr
Copy link
Copy Markdown

@karrtikr karrtikr commented Sep 25, 2021

Closes #17519

@karrtikr karrtikr added the skip package*.json package.json and package-lock.json don't both need updating label Sep 25, 2021
@karrtikr karrtikr marked this pull request as draft September 25, 2021 00:17
@karrtikr karrtikr changed the title Only activate Pylance when running in virtual workspaces Only activate language servers when running in virtual workspaces Nov 9, 2021
Comment thread src/client/activation/common/analysisOptions.ts Outdated
Comment thread src/client/common/constants.ts Outdated
Comment on lines 57 to 59
protected getDocumentFilters(_workspaceFolder?: WorkspaceFolder): DocumentFilter[] {
return PYTHON;
return this.workspace.isVirtualWorkspace ? [{ language: PYTHON_LANGUAGE }] : PYTHON;
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Support all virtual workspaces schemes.

@karrtikr karrtikr marked this pull request as ready for review November 11, 2021 17:48
Comment thread package.json Outdated
Comment thread src/client/activation/activationManager.ts Outdated
@jakebailey
Copy link
Copy Markdown
Member

For this, is there any reason to block interpreter access in virtual? I think it would be valid to have a local venv that you source type information from during the analysis; Pylance will fall back to calling python from $PATH if we don't have interpreter access (only in untrusted mode are we not running python).

@karrtikr
Copy link
Copy Markdown
Author

karrtikr commented Nov 12, 2021

Only reason is we wanted to start with the minimalistic features to make Pylance work 😄

For this, is there any reason to block interpreter access in virtual?

I think Pylance still does have access to the current interpreter, we only don't allow the user to change it. The ideal solution would be to just activate "interpreter" component along with language servers, I'll see if I can do that in this PR.

@karrtikr karrtikr marked this pull request as draft November 12, 2021 12:11
@karrtikr
Copy link
Copy Markdown
Author

Done, please have a look again, thanks!

@karrtikr karrtikr requested a review from jakebailey November 12, 2021 13:31
@karrtikr karrtikr marked this pull request as ready for review November 12, 2021 13:31
Comment thread src/client/activation/types.ts Outdated
Comment thread src/client/activation/types.ts Outdated
@jakebailey
Copy link
Copy Markdown
Member

LS stuff seems fine to me, but since I'm leaving (and will be gone for two weeks on vacation), I think it'd be best for someone else to give this a try too.

@karrtikr karrtikr requested review from karthiknadig and removed request for karthiknadig November 15, 2021 11:43
@karrtikr
Copy link
Copy Markdown
Author

Ping @karthiknadig

@karrtikr karrtikr added this to the November 2021 milestone Nov 15, 2021
@karrtikr karrtikr merged commit d4644dc into microsoft:main Nov 16, 2021
@karrtikr karrtikr deleted the pylancevirtualt branch November 16, 2021 13:10
wesm pushed a commit to posit-dev/positron that referenced this pull request Mar 28, 2024
…crosoft/vscode-python#17519)

* Only activate Pylance when running in virtual workspaces

* News entry

* Trigger intelliSense analysis for all schemes of python code

* Also support Jedi in virtual workspaces

* Rebase with main

* Oops

* Only support known virtual workspace scheme

* Look into all python schemes when in a virtual workspace

* Fix some tests

* Fix mistake

* Do not register Jupyter hooks when using virtual workspaces

* Nit

* Only activate interpreter and language server component when in a virtual workspace

* Make component id a mandatory field in extension activation services

* Refactor

* Use supported workspace types instead of component id

* Fix lint

* Code reviwes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip package*.json package.json and package-lock.json don't both need updating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants