Skip to content
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

Python linter/formatter extensions don't support virtual workspaces #21459

Assignees
Labels
important Issue identified as high-priority verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@Pokeylooted
Copy link

Issue:
Some extensions are failing to start, below is an example of Ruff.

Error message:

Name: Ruff
Module: ruff
Python extension loading
Waiting for interpreter from python extension.
Python extension loaded
Server Command [RUN]: c:\Users\pokey\AppData\Local\Microsoft\WindowsApps\python3.11.exe c:\Users\pokey\.vscode\extensions\charliermarsh.ruff-2023.20.0-win32-x64\bundled\tool\server.py
Server Command [DEBUG]: c:\Users\pokey\AppData\Local\Microsoft\WindowsApps\python3.11.exe c:\Users\pokey\.vscode\extensions\charliermarsh.ruff-2023.20.0-win32-x64\bundled\tool\_debug_server.py
[Error - 12:29:32 AM] Starting client failed
Launching server using command c:\Users\pokey\AppData\Local\Microsoft\WindowsApps\python3.11.exe failed.

Steps to reproduce:

  1. Have some of the extensions failing to start enabled
  2. Install the Github Repositories Extension.
  3. Click the blue/green button in the bottom left corner and select “Open remote repository”.
  4. Select the desired repository.
  5. Upon loading, an error message will appear in the bottom right corner.

Note:
The Black Formatter and iSort extensions also exhibit the same issues.

iSort console output

I can reproduce this on macOS. Note as an additional step I had to add the repository's directory to my "trusted" directories.

Name: Ruff
Module: ruff
Python extension loading
Waiting for interpreter from python extension.
Python extension loaded
Server Command [RUN]: /opt/homebrew/bin/python3 /Users/mz/.vscode/extensions/charliermarsh.ruff-2023.20.0-darwin-arm64/bundled/tool/server.py
Server Command [DEBUG]: /opt/homebrew/bin/python3 /Users/mz/.vscode/extensions/charliermarsh.ruff-2023.20.0-darwin-arm64/bundled/tool/_debug_server.py
[Error - 10:03:42 AM] Starting client failed
Launching server using command /opt/homebrew/bin/python3 failed.
isort also failed to load

Name: isort
Module: isort
Python extension loading
Waiting for interpreter from python extension.
Python extension loaded
[Error - 10:03:42 AM] Starting client failed
Launching server using command /opt/homebrew/bin/python3 failed.

Version - v0.58.0
Link to Ruff ruff issue about this

@joyceerhl
Copy link

@Pokeylooted the GitHub Repositories extension serves file contents using a virtual file system, i.e. the files do not exist on disk: https://code.visualstudio.com/api/extension-guides/virtual-workspaces.

If these linter/formatter extensions work by running a Python module against files in a workspace and don't already support virtual file systems, then that would be why they don't work in GitHub Repositories. This would then actually be an issue for the linter/formatter extensions to support virtual file systems.

You mention isort not working, can you please provide the extension IDs that don't work in GitHub Repositories?

@joyceerhl joyceerhl added the info-needed Issue requires more information from poster label Jun 19, 2023
@joyceerhl joyceerhl self-assigned this Jun 19, 2023
@Pokeylooted
Copy link
Author

@Pokeylooted the GitHub Repositories extension serves file contents using a virtual file system, i.e. the files do not exist on disk: https://code.visualstudio.com/api/extension-guides/virtual-workspaces.

If these linter/formatter extensions work by running a Python module against files in a workspace and don't already support virtual file systems, then that would be why they don't work in GitHub Repositories. This would then actually be an issue for the linter/formatter extensions to support virtual file systems.

You mention isort not working, can you please provide the extension IDs that don't work in GitHub Repositories?

Hey! Thanks for reaching, out I actually thought that too, and reached out to the developers of the extension: astral-sh/ruff-vscode#211 (comment)

That's where I found other people with the same problem One of them mentioning the same with iSort. which can be recreated with this plugin: https://marketplace.visualstudio.com/items?itemName=ms-python.isort

@joyceerhl joyceerhl transferred this issue from microsoft/vscode-remote-repositories-github Jun 20, 2023
@joyceerhl joyceerhl changed the title Remote Repositories Failing to start some extensions Python linter/formatter extensions don't support virtual workspaces Jun 20, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jun 20, 2023
@karthiknadig
Copy link
Member

Virtual workspaces is not yet supported. I will update the extension with the right flags to indicate that.

@karthiknadig
Copy link
Member

@charliermarsh Can you make similar change to Ruff extension? microsoft/vscode-black-formatter#256

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jun 26, 2023
@charliermarsh
Copy link

Will do, thanks @karthiknadig.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jun 26, 2023
@karthiknadig karthiknadig added verification-needed Verification of issue is requested and removed triage-needed Needs assignment to the proper sub-team labels Jun 26, 2023
@alexr00 alexr00 added verified Verification succeeded and removed verified Verification succeeded labels Jun 28, 2023
@alexr00
Copy link
Member

alexr00 commented Jun 28, 2023

I have tested isort and black pre-release extensions, and neither of them seem to support virtual workspaces.

image

@alexr00 alexr00 reopened this Jun 28, 2023
@alexr00 alexr00 added the verification-found Issue verification failed label Jun 28, 2023
@joyceerhl
Copy link

@alexr00 actually I think you've verified the fix, because previously these extensions were not disabled in virtual workspaces even though they didn't support them properly. @karthiknadig is working on allowing Python linters/formatters to work in virtual workspaces over LSP, so this issue in the meantime just ensures that the extensions don't do inappropriate things while they lack the ability to support virtual workspaces

@joyceerhl joyceerhl added verified Verification succeeded and removed verification-found Issue verification failed labels Jun 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2023
@eleanorjboyd eleanorjboyd removed the needs PR Ready to be worked on label Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.