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

Fix LSP-ruff just doesn't work for new installation #62

Closed
wants to merge 1 commit into from

Conversation

jfcherng
Copy link
Contributor

@jfcherng jfcherng commented Jun 29, 2024

Description

LSP-ruff at this moment just doesn't do any diagnosis for people who install LSP-ruff now because for a new user, LSP-ruff will install ruff-lsp==0.0.52 and ruff==0.5.0 but they don't work together.

LSP-ruff: LOG: error: `ruff <path>` has been removed. Use `ruff check <path>` instead.

The ruff <path> usage has been removed in ruff 0.5.0: https://github.com/astral-sh/ruff/releases/tag/0.5.0

Reproduction

You can remove LSP-ruff and reinstall it. Then supposedly the installed ruff will be bumped up to 0.5.0 (and ruff-lsp will hit `ruff <path>` has been removed.).

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
@jfcherng jfcherng changed the title Fix ruff-lsp==0.0.52 doesn't work with ruff==0.5.0 Fix LSP-ruff just doesn't work for new installation Jun 29, 2024
@vgoklani
Copy link

I just did a fresh install of sublime text and installed LSP-ruff (v1.1) from April 19, 2024 - and ruff is not working for me :(

These are the versions of the libraries installed:
Name: ruff-lsp - Version: 0.0.54
Name: ruff - Version: 0.5.0

How do I fix this directly? Do I have to wait for the merge? Thanks!

@jfcherng
Copy link
Contributor Author

jfcherng commented Jun 29, 2024

Name: ruff-lsp - Version: 0.0.54
Name: ruff - Version: 0.5.0

Your combination should work. I don't know why yours is 0.0.54 though. LSP-ruff pins ruff-lsp==0.0.52 at this moment.

@vgoklani
Copy link

vgoklani commented Jun 29, 2024

Thanks for the reply!

I see this in the console:

LSP: LSP-ruff: Supported execute commands: ['ruff.applyAutofix', 'ruff.applyOrganizeImports', 'ruff.applyFormat']
LSP: LSP-ruff: supported code action kinds: ['quickfix', 'source.fixAll', 'source.organizeImports', 'source.fixAll.ruff', 'source.organizeImports.ruff', 'notebook.source.fixAll', 'notebook.source.organizeImports', 'notebook.source.fixAll.ruff', 'notebook.source.organizeImports.ruff']
LSP-ruff: LOG: Using interpreter executable: /Users/vgoklani/Library/Caches/Sublime Text/Package Storage/LSP-ruff/bin/ruff
LSP-ruff: LOG: Inferred version 0.5.0 for: /Users/vgoklani/Library/Caches/Sublime Text/Package Storage/LSP-ruff/bin/ruff
LSP-ruff: LOG: Found ruff 0.5.0 at /Users/vgoklani/Library/Caches/Sublime Text/Package Storage/LSP-ruff/bin/ruff
LSP-ruff: LOG: Running Ruff with: /Users/vgoklani/Library/Caches/Sublime Text/Package Storage/LSP-ruff/bin/ruff ['--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--config', '/Users/vgoklani/ruff.toml', '--stdin-filename', '/Users/vgoklani/scratch/scratch.py']
LSP-ruff: LOG: error: `ruff <path>` has been removed. Use `ruff check <path>` instead.

I removed the cache folder and also uninstalled and re-installed lsp-ruff, but it keeps install 0.5.0

Is there any way of not having it reference the cache, and forcing it to update to a different version

@jfcherng
Copy link
Contributor Author

jfcherng commented Jun 29, 2024

It looks like you don't know how to override a plugin file with your own. You basically use the same filesystem struct but in Packages/. You have to create Packages/LSP-ruff/requirements.txt with the content like what it is in this PR. An issue of doing so is that now ST will always use the override file you've created even if the plugin updates in the future.

@vgoklani
Copy link

Thanks for the reply!

To clarify, I should add a requirements.txt file here:

  • $HOME/Library/Application Support/Sublime Text/Packages/LSP-ruff/requirements.txt
  • and put ruff-lsp==0.0.54 inside the file

How does this get installed? And how will the LSP-ruff know to use this version going forward?

It's currently loading ruff from the cache:

  • $HOME/Library/Caches/Sublime Text/Package Storage/LSP-ruff/bin/ruff

Thanks!

@jfcherng
Copy link
Contributor Author

You can delete the whole Package Storage/LSP-ruff and restart ST. LSP-ruff should install ruff-lsp==0.0.54 since then.

@jfcherng
Copy link
Contributor Author

  • $HOME/Library/Application Support/Sublime Text/Packages/LSP-ruff/requirements.txt

I've never used MacOS. The Packages/ I mean is the directory when you click on "Browse Packages..."
image

@LDAP
Copy link
Collaborator

LDAP commented Jun 30, 2024

#63

@LDAP LDAP closed this Jun 30, 2024
@jfcherng jfcherng deleted the fix/new-user branch June 30, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants