-
Notifications
You must be signed in to change notification settings - Fork 23
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
Exception when imports are unsorted #98
Comments
Hmm, I cannot reproduce this. Can you increase the verbosity of pylsp and save to a log file? See https://github.com/python-lsp/python-lsp-ruff?tab=readme-ov-file#debugging for inspiration (I don't know how to translate that to spacemacs though) |
OK, here the pylsp_stderr.log when the verbosity has been set to BTW: In Spacemacs you just have to add the single line lsp-pylsp-server-command '("pylsp" "-vvv") to the LSP config mentioned above to raise the verbosity level.. Note that today we have |
Hmm okay, something is performing a ruff check and returns it to pylsp but with slightly different keys in the python-lsp-ruff/pylsp_ruff/ruff.py Lines 11 to 15 in 041c695
However, yours contain newText and a range . I just checked and python-lsp-ruff has never used these keys so I don't think that its a version error.I am not sure where these diagnostics come from, but something messes with python-lsp-server . Can you make sure that absolutely no other ruff linter is present in your emacs setup?I also found this where at least a similar diagnostic syntax is found: emacs-lsp/lsp-mode#4547 |
Hmmm, if one follows the LSP spec from textDocument/diagnostic through to Diagnostic, one ends up at LSPAny for (Disclaimer: I've got only some superficial knowledge about the whole LSP protocol, so I'm just guessing here) |
That's not in the spec, but rather the edit format you get when calling |
I did find this: https://github.com/astral-sh/ruff/blob/03f3a4e85560333cf7175d44849f7250a6cdcb6a/crates/ruff_server/src/lint.rs#L40 |
Hmmm, this is how the process/thread tree for my Emacs looks like:
This is consistent with the Emacs code for the LSP mode: https://github.com/emacs-lsp/lsp-mode/blob/561788352cd566558d303f72821c160295089839/clients/lsp-ruff.el#L34 Should this structure look different somehow, e.g. |
I think you are confusing |
I think I finally understand what's going on: lsp-mode explicitly uses AFAICT, So when one uses In a nutshell: Nothing seems to be wrong here, sorry for the noise, this ticket here can be closed. But OTOH, I think the Spacemcas docu needs some love, the LSP ecosystem for Python is quite confusing... |
It doesn't work together with python-lsp-server, see python-lsp/python-lsp-ruff#98 Background: python-lsp-server handles ruff via its add-on machinery, and python-lsp-ruff interferes with this. Change-Id: I14c4b5d67124b0cf5102cba1cf419489f4b5bd9a
python-lsp-ruff
generates an exception "cattrs.errors.ClassValidationError: While structuring Fix (3 sub-exceptions)" (see pylsp_stderr.log) in the following simple scenario: Start with a Python fileand edit it to look like
The imports are clearly unsorted and ruff detects that, but somehow this leads to the exception above. As additional info, I'm attaching the contents of the Emacs buffers related to pylsp and ruff: lsp-log_pylsp.log and lsp-log_ruff.log
Some more infos:
python-lsp-ruff
version 2.2.2ruff
version 0.6.5pyproject.toml
(full version here):The text was updated successfully, but these errors were encountered: