Open lieryan opened 7 months ago
The error code is not part of the message. However, pylsp-mypy passes the error code with the message to pylsp which in turn gives it to your editor (as far as I know). The editor is then responsible for displaying it is so desired by the user.
The only quick fix I can think of would be the ignore. Is there another you would like to see implemented?
Adding type: ignore
is pretty much the only use case I needed it for now. I can run mypy <filename>
on the terminal for the rarer cases or just copy the error code from the code action.
However, pylsp-mypy passes the error code with the message to pylsp which in turn gives it to your editor (as far as I know)
Thanks for the pointer, I'll double check if this is something that my LSP client can be configured to do.
I think I've noticed the same problem with ruff, too. I get the description of the error, but not the actual code. I am using neovim's builtin LSP client.
The code action is implemented now. From my testing client support was not as straight forward as I expected. Feel free to try the current master and tell me if it works.
@ccordoba12 Quick question: Does Spyder support LSP code actions, because I did not find them.
The quickfix action works well so far on master, I hadn't noticed any issues. Tested on vim-lsp.
Thanks @Richardk2n!
Use case
Whenever I want to add an
# type ignore[xxx]
for an error, I often need to recall what error code that this particular error message has.It would be nice if the diagnostic message produced by pylsp-mypy would also display the error code, similar to mypy's default error message on the CLI:
Additionally, it'd be even nicer if there's a code action that allows you to add an ignore line and/or automatically suggest some common quick fixes for some of the more common error codes.