Skip to content
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

How to set pyls.configurationSources? #504

Open
lucas-mior opened this issue Apr 23, 2024 · 2 comments
Open

How to set pyls.configurationSources? #504

lucas-mior opened this issue Apr 23, 2024 · 2 comments

Comments

@lucas-mior
Copy link

lucas-mior commented Apr 23, 2024

python-language-server's README goes as follows:

The default configuration source is pycodestyle. Change the pyls.configurationSources setting to ['flake8'] in order to respect flake8 configuration instead.
Overall configuration is computed first from user configuration (in home directory), overridden by configuration passed in by the language client, and then overriden by configuration discovered in the workspace.
To enable pydocstyle for linting docstrings add the following setting in your LSP configuration:
"pyls.plugins.pydocstyle.enabled": true

How is it done with this vim 9 lsp?

@ptgolden
Copy link

ptgolden commented Oct 1, 2024

From :help lsp-cfg-workspaceConfig:

workspaceConfig (Optional) a json encodable value that will be sent to
                the language server after initialization as the       
                "settings" in a "workspace/didChangeConfiguration"    
                notification.  Refer to the language server           
                documentation for the values that will be accepted in 
                this notification.  This configuration is also used to
                respond to the "workspace/configuration" request      
                message from the language server.                     

Given that pyls configures options through workspaceConfig, this seems like the place to configure it.

(Just figured this out myself setting things up.)

@ptgolden
Copy link

ptgolden commented Oct 1, 2024

Here's an example from my .vimrc that is working:

call lsp#lsp#AddServer([#{                       
  \ name: 'python-language-server',              
  \ filetype: ['python'],                        
  \ path: '/home/ptgolden/.local/bin/pylsp',     
  \ workspaceConfig: {                           
  \   'pylsp': {                                 
  \     'configurationSources': [],              
  \     'plugins': {                             
  \       'autopep8': {                          
  \         'enabled': 0,                        
  \       },                                     
  \       'pyflakes': {                          
  \         'enabled': 0,                        
  \       },                                     
  \       'pycodestyle': {                       
  \         'enabled': 0,                        
  \       },                                     
  \       'jedi': {                              
  \         'environment': GetPythonEnvironment()
  \       }                                      
  \     }                                        
  \   }                                          
  \ }                                            
  \ }])                                          

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants