Skip to content

Only activate language servers when running in virtual workspaces - #17519

Merged
Kartik Raj (karrtikr) merged 18 commits into
microsoft:mainfrom
karrtikr:pylancevirtualt
Nov 16, 2021
Merged

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

Conversation

@karrtikr

@karrtikr Kartik Raj (karrtikr) commented Sep 25, 2021

Copy link
Copy Markdown

Closes #17519

@karrtikr Kartik Raj (karrtikr) added the skip package*.json package.json and package-lock.json don't both need updating label Sep 25, 2021
@karrtikr
Kartik Raj (karrtikr) marked this pull request as draft September 25, 2021 00:17
@karrtikr Kartik Raj (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.

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

Kartik Raj (karrtikr) commented Nov 12, 2021

Copy link
Copy Markdown
Author

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
Kartik Raj (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
Kartik Raj (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

Copy link
Copy Markdown
Author

Ping Karthik Nadig (@karthiknadig)

@karrtikr Kartik Raj (karrtikr) added this to the November 2021 milestone Nov 15, 2021
@karrtikr
Kartik Raj (karrtikr) merged commit d4644dc into microsoft:main Nov 16, 2021
@karrtikr
Kartik Raj (karrtikr) deleted the pylancevirtualt branch November 16, 2021 13:10
Wes McKinney (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