Show example config in JSON
mattiasb opened this issue · 3 comments
Hi!
I'm looking at setting some config values for python-lsp-ruff for my editor
but I don't know how to translate from the neovim syntax to regular JSON.
Would it perhaps make sense to show the config in the README in JSON format
instead? Having looked at documentation for several LSP servers that seems to be
the most common approach and then Emacs, (neo)vim and other users can translate
that JSON to their internal config language.
If not, maybe linking to the PluginSettings class could be helpful. :)
Hi, can you point me to such an example json config for another LSP / do you have something that is working? If I have a working example I can put it into the README, but I am not sure what a working JSON syntax would be
Looking around a bit it seems that I was wrong. Sorry for that.
As a side note I'm more confused than ever about how LSP servers
are configured. There seems to be workspace/didChangeConfiguration
and something called initializationOptions and the servers
(especially those I don't currently use) seem to do a bit of both.
Ok, having read a bit more (and I'm guessing a bit now!) the former
seems to be the config values that can change dynamically over the
lifetime of a server process. The latter seems to be sent on start
up of the server only.
However, what the projects I do use seem to do is to have a lax
schema for the workspace/didChangeConfiguration JSON in written
text somewhere or just link to the code that sets the schema up.
Some examples:
- pyright
- python-lsp-server
- bash-language-server — Just a link to the code
Anyhow. The issue for me was just that I had no idea how to translate
the nvim syntax to JSON. And as soon as I found the PluginSettings Class
I could cross reference that with the nvim syntax and understand and
deduce how the nvim syntax work.
This would be the example config from the main page in JSON FWIW:
{
"pylsp": {
"plugins": {
"ruff": {
"enabled": true,
"formatEnabled": true,
"executable": "<path-to-ruff-bin>",
"config": "<path_to_custom_ruff_toml>",
"extendSelect": [ "I" ],
"extendIgnore": [ "C90"],
"format": [ "I" ],
"severities": {
"D212": "I"
},
"unsafeFixes": false,
"lineLength": 88,
"exclude": ["__about__.py"],
"select": ["F"],
"ignore": ["D210"],
"perFileIgnores": {
"__init__.py": "CPY001"
},
"preview": false,
"targetVersion": "py310"
}
}
}
}
Anyhow. Do with this information what you will. The above example
would've helped me but the next person might not have such a hard
time. :)
Also thanks for a great project, I use it daily now!
I added the JSON config to the README, thanks a lot:)