koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
173 stars 6 forks source link

plugin looks for the ruff binaries in the wrong directory or misconfig? #452

Open ar4hc opened 4 weeks ago

ar4hc commented 4 weeks ago

Describe the bug

i see log entries like this:

INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;6): window/logMessage Log: Interpreter executable (/opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff) not found

running on a mac with brew installed ruff.

The error seems valid as /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff isn't there and i suspect it should be /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff-lsp (with -lsp at the end) which exists, and is the only binary in this dir.

Autodetect in the plugin config finds '/opt/homebrew/bin/ruff' and ...'-lsp', both links to the existing binaries.

It still seems to work though...

i created a link in the ruff-lsp dir to the ruff bin, like ln -s ../../../../ruff/0.4.8/bin/ruff and then see logs like

INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;6): window/logMessage Log: Using interpreter executable: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;6): window/logMessage Log: Found ruff 0.4.8 at /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;6): window/logMessage Log: Running Ruff with: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/Users/...py']

Which means the plugin is still using cli ruff to format...?

To Reproduce Steps to reproduce the behavior:

  1. Configure ruff plugin with everything checked.
  2. open logs
  3. wait...

Expected behavior plugin should find the correct binary for rust-lsp.

Environments (please complete the following information):

Additional context Probably a misconfig here... not sure...

ar4hc commented 3 weeks ago

today i get an infinit loop of those log entries:

INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: []
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Using interpreter executable: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Found ruff 0.4.8 at /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Running Ruff with: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--fix', '--stdin-filename', 'foo.py']
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Using interpreter executable: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Found ruff 0.4.8 at /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Running Ruff with: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--fix', '--select', 'I001', '--select', 'I002', '--stdin-filename', 'foo.py']
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Using interpreter executable: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Found ruff 0.4.8 at /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: Running Ruff with: /opt/homebrew/Cellar/ruff-lsp/0.0.53/libexec/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--fix', '--select', 'I001', '--select', 'I002', '--stdin-filename', 'foo.py']
INFO - #c.i.p.l.i.LspServerImpl - RuffLspServerDescriptor@classifier-api(Running;9): window/logMessage Log: []

foo.py was a real absolute path...