diff --git a/README.md b/README.md index 1bf7a900..cb31bf98 100644 --- a/README.md +++ b/README.md @@ -59,19 +59,34 @@ Please file an issue if you require assistance writing a plugin. ## Configuration -Configuration is loaded from zero or more configuration sources. Currently implemented are: +Like all language servers, configuration can be passed from the client that talks to this server (i.e. your editor/IDE or other tool that has the same purpose). The details of how this is done depend on the editor or plugin that you are using to communicate with `python-lsp-server`. The configuration options available at that level are documented in [`CONFIGURATION.md`](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md). -- pycodestyle: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`. -- flake8: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg` +`python-lsp-server` depends on other tools, like flake8 and pycodestyle. These tools can be configured via settings passed from the client (as above), or alternatively from other configuration sources. The following sources are available: -The default configuration source is pycodestyle. Change the `pylsp.configurationSources` setting to `['flake8']` in order to respect flake8 configuration instead. +- `pycodestyle`: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`. +- `flake8`: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg` + +The default configuration source is `pycodestyle`. Change the `pylsp.configurationSources` setting (in the value passed in from your client) to `['flake8']` in order to use the flake8 configuration instead. + +The configuration options available in these config files (`setup.cfg` etc) are documented in the relevant tools: + +- [flake8 configuration](https://flake8.pycqa.org/en/latest/user/configuration.html) +- [pycodestyle configuration](https://pycodestyle.pycqa.org/en/latest/intro.html#configuration) Overall configuration is computed first from user configuration (in home directory), overridden by configuration passed in by the language client, and then overridden by configuration discovered in the workspace. -To enable pydocstyle for linting docstrings add the following setting in your LSP configuration: -`"pylsp.plugins.pydocstyle.enabled": true` +As an example, to change the list of errors that pycodestyle will ignore, assuming you are using the `pycodestyle` configuration source (the default), you can: + +1. Add the following to your ~/.config/pycodestyle: + + ``` + [pycodestyle] + ignore = E226,E302,E41 + ``` + +2. Set the `pylsp.plugins.pycodestyle.ignore` config value from your editor +3. Same as 1, but add to `setup.cfg` file in the root of the project. -All configuration options are described in [`CONFIGURATION.md`](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md). ## LSP Server Features