Unable to disable plugin
matthewsia98 opened this issue · 6 comments
Setting enabled key here does not affect anything.
However, setting ignore key causes ruff to ignore the specified key.
pylsp settings
local lspconfig = require("lspconfig")
lspconfig["pylsp"].setup({
settings = {
pylsp = {
plugins = {
ruff = {
enabled = false,
ignore = {
"E741",
},
},
},
},
},
Hmm, this is odd indeed, I can reproduce this issue even when setting
@hookimpl
def pylsp_settings():
return {
"plugins": {
"ruff": {
"enabled": False,
},
}
}in the package itself. Do you have any idea @ccordoba12? I think pylsp is messing up here
I checked this and (I don't know why), third-party plugins can only be disabled by passing their module names. So, the above configuration should be:
local lspconfig = require("lspconfig")
lspconfig["pylsp"].setup({
settings = {
pylsp = {
plugins = {
pylsp_ruff = {
enabled = false,
},
ruff = {
ignore = {
"E741",
},
},
},
},
},
That works for me in Spyder.
Ok, I understood what happens. Plugins are enabled/disabled according to their entry point names. In this case, that name is pylsp_ruff, not ruff:
python-lsp-ruff/pyproject.toml
Lines 23 to 24 in fc6adcd
So, there are two possible solutions for this:
- Rename the entry option to be
ruff. I think that's safe because the server only loads plugins decorated with@hookimpl. - Rename the options namespace to be
pylsp_ruffinstead ofruff.
Thanks for the help @ccordoba12! I'd rather stick to 1. to keep the plugin configurations consistent. Unfortunately I am unfamiliar with pluggy, changing the pyproject.toml in you code snippet to
[project.entry-points.pylsp]
ruff = "pylsp_ruff.ruff_lint"doesn't fix it on my side. Am I missing something?
Am I missing something?
Yes, changing the name is not enough. Afterwards, you need to uninstall the plugin and reinstall it again in development mode for the change to take effect.
I tested it locally and it works for me with Spyder, so I'll submit a PR for it.
Right, that was it. Thanks for the help!

