Skip to content

Only activate language servers when running in virtual workspaces #17519

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 18 commits into from
Nov 16, 2021

Conversation

karrtikr
Copy link

@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 on lines 57 to 59
protected getDocumentFilters(_workspaceFolder?: WorkspaceFolder): DocumentFilter[] {
return PYTHON;
return this.workspace.isVirtualWorkspace ? [{ language: PYTHON_LANGUAGE }] : PYTHON;
}
Copy link
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
@jakebailey
Copy link
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
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
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
@jakebailey
Copy link
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
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