Skip to content

Commit 8add687

Browse files
authored
Improved documentation regarding configuration (#174)
1 parent 552dea3 commit 8add687

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

Diff for: README.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,34 @@ Please file an issue if you require assistance writing a plugin.
5959

6060
## Configuration
6161

62-
Configuration is loaded from zero or more configuration sources. Currently implemented are:
62+
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).
6363

64-
- pycodestyle: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`.
65-
- flake8: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg`
64+
`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:
6665

67-
The default configuration source is pycodestyle. Change the `pylsp.configurationSources` setting to `['flake8']` in order to respect flake8 configuration instead.
66+
- `pycodestyle`: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`.
67+
- `flake8`: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg`
68+
69+
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.
70+
71+
The configuration options available in these config files (`setup.cfg` etc) are documented in the relevant tools:
72+
73+
- [flake8 configuration](https://flake8.pycqa.org/en/latest/user/configuration.html)
74+
- [pycodestyle configuration](https://pycodestyle.pycqa.org/en/latest/intro.html#configuration)
6875

6976
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.
7077

71-
To enable pydocstyle for linting docstrings add the following setting in your LSP configuration:
72-
`"pylsp.plugins.pydocstyle.enabled": true`
78+
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:
79+
80+
1. Add the following to your ~/.config/pycodestyle:
81+
82+
```
83+
[pycodestyle]
84+
ignore = E226,E302,E41
85+
```
86+
87+
2. Set the `pylsp.plugins.pycodestyle.ignore` config value from your editor
88+
3. Same as 1, but add to `setup.cfg` file in the root of the project.
7389

74-
All configuration options are described in [`CONFIGURATION.md`](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md).
7590

7691
## LSP Server Features
7792

0 commit comments

Comments
 (0)