Languageclient-neovim: Pyls settings.json

Created on 25 May 2018  ·  7Comments  ·  Source: autozimu/LanguageClient-neovim

I am no sure weather to ask the question here or at Python-language-server.

I am trying to configure the language server, so I made a folder .vim and but a file settings.json with the content:

"pyls": {
  "plugins": {
    "pydocstyle": {
      "enabled": true
    }
  }
}

This seems not to work. The only reference i have is for vscode.

The question is now, how I have to write the json file, that pyls accepts it. Is there a way to check, if the client detected the file properly?

Most helpful comment

Not sure whether pyls has changed since previous comments, but here's the .vim/settings.json format that work for configuring with pyls.__version__ '0.26.1' and LanguageClient-neovim git hash 6ee4c89.

{
    "pyls.plugins.pyflakes.enabled": false,
    "pyls.plugins.pydocstyle.enabled": false,
    "pyls.plugins.rope.enabled": true,
    "pyls.plugins.pycodestyle.enabled": false,
    "pyls.plugins.mccabe.enabled": false,
    "pyls.plugins.autopep8.enabled": false,
    "pyls.plugins.papf.enabled": false
}

To verify, started pyls with:

let g:LanguageClient_serverCommands = {
    \ 'python': ['pyls', '-vv', '--log-file', '~/pyls.log'],
    \ }

And grep log:

> grep "Updated sett" pyls.log
2019-05-10 06:39:23,337 UTC - INFO - pyls.config.config - Updated settings to {'plugins': {'autopep8': {'enabled': False},...

All 7 comments

I have the same problem with the rust language server. There seems to be large delay before rls detects a code change, so I wanted to change the "wait_to_build" value. The issue is that I can't verify whether rls actually accepted my settings.josn file.

@DerWeh your json file is syntactically broken. It needs opening and closing curly braces. This is what I use:

{
    "pyls": {
        "plugins": {
            "pyflakes": {
                "enabled": true
            },
            "pydocstyle": {
                "enabled": true
            }
        }
    }
}

If you configure pyls to start with -vv you can observe whether it accepts the settings in the debug output sent to /tmp/LanguageServer.log.

I believe @languitar's comment should have answered the original question.

In VSCode, the settings are using condensed structure. When those settings are passed to language servers, they're expanded by splitting with ..

And this is an example of send settings to rust language server, https://github.com/autozimu/LanguageClient-neovim/blob/next/.vim/settings.json

@autozimu btw, do you think it is wise to have a single default settings file configured in .vim? I have to change the language server configuration from project to project by settings something like let g:LanguageClient_settingsPath = 'ls-settings.json' (so relative to _the project root_).

Are you talking about the same thing as in https://github.com/autozimu/LanguageClient-neovim/issues/431?

Ah yes. Thanks. I'll follow that issue.

Not sure whether pyls has changed since previous comments, but here's the .vim/settings.json format that work for configuring with pyls.__version__ '0.26.1' and LanguageClient-neovim git hash 6ee4c89.

{
    "pyls.plugins.pyflakes.enabled": false,
    "pyls.plugins.pydocstyle.enabled": false,
    "pyls.plugins.rope.enabled": true,
    "pyls.plugins.pycodestyle.enabled": false,
    "pyls.plugins.mccabe.enabled": false,
    "pyls.plugins.autopep8.enabled": false,
    "pyls.plugins.papf.enabled": false
}

To verify, started pyls with:

let g:LanguageClient_serverCommands = {
    \ 'python': ['pyls', '-vv', '--log-file', '~/pyls.log'],
    \ }

And grep log:

> grep "Updated sett" pyls.log
2019-05-10 06:39:23,337 UTC - INFO - pyls.config.config - Updated settings to {'plugins': {'autopep8': {'enabled': False},...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mqudsi picture mqudsi  ·  3Comments

norcalli picture norcalli  ·  4Comments

skywind3000 picture skywind3000  ·  5Comments

martskins picture martskins  ·  3Comments

ABitMoreDepth picture ABitMoreDepth  ·  3Comments