From d06ddefe3905582b6c92edbaf565d2ff462d4d27 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Thu, 17 Mar 2022 10:26:18 +0000 Subject: [PATCH 1/2] Improved documentation regarding configuration - Better clarity on where config is coming from - Links to flake8/pycodestyle docs - Example Refs #172 --- README.md | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1bf7a900..8ae423c8 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 (i.e. the editor/IDE or other tool). 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 respect 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 From 10ef6405371f75d92fb6289d393744aa2f33b476 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Fri, 18 Mar 2022 13:22:44 +0000 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8ae423c8..cb31bf98 100644 --- a/README.md +++ b/README.md @@ -59,14 +59,14 @@ Please file an issue if you require assistance writing a plugin. ## Configuration -Like all language servers, configuration can be passed from the client (i.e. the editor/IDE or other tool). 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). +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). -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: +`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: - `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 respect flake8 configuration instead. +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: