Skip to content

Commit ff41880

Browse files
authored
Update the configuration schema for consistency (#267)
1 parent 449d11a commit ff41880

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

CONFIGURATION.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Python Language Server Configuration
2-
This server can be configured using `workspace/didChangeConfiguration` method. Each configuration option is described below:
2+
This server can be configured using the `workspace/didChangeConfiguration` method. Each configuration option is described below. Note, a value of `null` means that we do not set a value and thus use the plugin's default value.
33

44
| **Configuration Key** | **Type** | **Description** | **Default**
55
|----|----|----|----|
6-
| `pylsp.configurationSources` | `array` of unique `string` (one of: `pycodestyle`, `pyflakes`) items | List of configuration sources to use. | `["pycodestyle"]` |
6+
| `pylsp.configurationSources` | `array` of unique `string` (one of: `'pycodestyle'`, `'flake8'`) items | List of configuration sources to use. | `["pycodestyle"]` |
77
| `pylsp.plugins.autopep8.enabled` | `boolean` | Enable or disable the plugin (disabling required to use `yapf`). | `true` |
88
| `pylsp.plugins.flake8.config` | `string` | Path to the config file that will be the authoritative config source. | `null` |
99
| `pylsp.plugins.flake8.enabled` | `boolean` | Enable or disable the plugin. | `false` |
@@ -25,7 +25,7 @@ This server can be configured using `workspace/didChangeConfiguration` method. E
2525
| `pylsp.plugins.jedi_completion.include_function_objects` | `boolean` | Adds function objects as a separate completion item. | `true` |
2626
| `pylsp.plugins.jedi_completion.fuzzy` | `boolean` | Enable fuzzy when requesting autocomplete. | `false` |
2727
| `pylsp.plugins.jedi_completion.eager` | `boolean` | Resolve documentation and detail eagerly. | `false` |
28-
| `pylsp.plugins.jedi_completion.resolve_at_most` | `number` | How many labels and snippets (at most) should be resolved? | `25` |
28+
| `pylsp.plugins.jedi_completion.resolve_at_most` | `integer` | How many labels and snippets (at most) should be resolved? | `25` |
2929
| `pylsp.plugins.jedi_completion.cache_for` | `array` of `string` items | Modules for which labels and snippets should be cached. | `["pandas", "numpy", "tensorflow", "matplotlib"]` |
3030
| `pylsp.plugins.jedi_definition.enabled` | `boolean` | Enable or disable the plugin. | `true` |
3131
| `pylsp.plugins.jedi_definition.follow_imports` | `boolean` | The goto call will follow imports. | `true` |
@@ -37,23 +37,23 @@ This server can be configured using `workspace/didChangeConfiguration` method. E
3737
| `pylsp.plugins.jedi_symbols.all_scopes` | `boolean` | If True lists the names of all scopes instead of only the module namespace. | `true` |
3838
| `pylsp.plugins.jedi_symbols.include_import_symbols` | `boolean` | If True includes symbols imported from other libraries. | `true` |
3939
| `pylsp.plugins.mccabe.enabled` | `boolean` | Enable or disable the plugin. | `true` |
40-
| `pylsp.plugins.mccabe.threshold` | `number` | The minimum threshold that triggers warnings about cyclomatic complexity. | `15` |
40+
| `pylsp.plugins.mccabe.threshold` | `integer` | The minimum threshold that triggers warnings about cyclomatic complexity. | `15` |
4141
| `pylsp.plugins.preload.enabled` | `boolean` | Enable or disable the plugin. | `true` |
4242
| `pylsp.plugins.preload.modules` | `array` of unique `string` items | List of modules to import on startup | `[]` |
4343
| `pylsp.plugins.pycodestyle.enabled` | `boolean` | Enable or disable the plugin. | `true` |
4444
| `pylsp.plugins.pycodestyle.exclude` | `array` of unique `string` items | Exclude files or directories which match these patterns. | `[]` |
4545
| `pylsp.plugins.pycodestyle.filename` | `array` of unique `string` items | When parsing directories, only check filenames matching these patterns. | `[]` |
46-
| `pylsp.plugins.pycodestyle.select` | `array` of unique `string` items | Select errors and warnings | `[]` |
46+
| `pylsp.plugins.pycodestyle.select` | `array` of unique `string` items | Select errors and warnings | `null` |
4747
| `pylsp.plugins.pycodestyle.ignore` | `array` of unique `string` items | Ignore errors and warnings | `[]` |
4848
| `pylsp.plugins.pycodestyle.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` |
49-
| `pylsp.plugins.pycodestyle.maxLineLength` | `number` | Set maximum allowed line length. | `null` |
49+
| `pylsp.plugins.pycodestyle.maxLineLength` | `integer` | Set maximum allowed line length. | `null` |
5050
| `pylsp.plugins.pycodestyle.indentSize` | `integer` | Set indentation spaces. | `null` |
5151
| `pylsp.plugins.pydocstyle.enabled` | `boolean` | Enable or disable the plugin. | `false` |
52-
| `pylsp.plugins.pydocstyle.convention` | `string` (one of: `pep257`, `numpy`, `None`) | Choose the basic list of checked errors by specifying an existing convention. | `null` |
52+
| `pylsp.plugins.pydocstyle.convention` | `string` (one of: `'pep257'`, `'numpy'`, `None`) | Choose the basic list of checked errors by specifying an existing convention. | `null` |
5353
| `pylsp.plugins.pydocstyle.addIgnore` | `array` of unique `string` items | Ignore errors and warnings in addition to the specified convention. | `[]` |
5454
| `pylsp.plugins.pydocstyle.addSelect` | `array` of unique `string` items | Select errors and warnings in addition to the specified convention. | `[]` |
5555
| `pylsp.plugins.pydocstyle.ignore` | `array` of unique `string` items | Ignore errors and warnings | `[]` |
56-
| `pylsp.plugins.pydocstyle.select` | `array` of unique `string` items | Select errors and warnings | `[]` |
56+
| `pylsp.plugins.pydocstyle.select` | `array` of unique `string` items | Select errors and warnings | `null` |
5757
| `pylsp.plugins.pydocstyle.match` | `string` | Check only files that exactly match the given regular expression; default is to match files that don't start with 'test_' but end with '.py'. | `"(?!test_).*\\.py"` |
5858
| `pylsp.plugins.pydocstyle.matchDir` | `string` | Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot. | `"[^\\.].*"` |
5959
| `pylsp.plugins.pyflakes.enabled` | `boolean` | Enable or disable the plugin. | `true` |

pylsp/config/schema.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"title": "Python Language Server Configuration",
4-
"description": "This server can be configured using `workspace/didChangeConfiguration` method. Each configuration option is described below:",
4+
"description": "This server can be configured using the `workspace/didChangeConfiguration` method. Each configuration option is described below. Note, a value of `null` means that we do not set a value and thus use the plugin's default value.",
55
"type": "object",
66
"properties": {
77
"pylsp.configurationSources": {
@@ -10,7 +10,7 @@
1010
"description": "List of configuration sources to use.",
1111
"items": {
1212
"type": "string",
13-
"enum": ["pycodestyle", "pyflakes"]
13+
"enum": ["pycodestyle", "flake8"]
1414
},
1515
"uniqueItems": true
1616
},
@@ -136,7 +136,7 @@
136136
"description": "Resolve documentation and detail eagerly."
137137
},
138138
"pylsp.plugins.jedi_completion.resolve_at_most": {
139-
"type": "number",
139+
"type": "integer",
140140
"default": 25,
141141
"description": "How many labels and snippets (at most) should be resolved?"
142142
},
@@ -199,7 +199,7 @@
199199
"description": "Enable or disable the plugin."
200200
},
201201
"pylsp.plugins.mccabe.threshold": {
202-
"type": "number",
202+
"type": "integer",
203203
"default": 15,
204204
"description": "The minimum threshold that triggers warnings about cyclomatic complexity."
205205
},
@@ -241,8 +241,8 @@
241241
"description": "When parsing directories, only check filenames matching these patterns."
242242
},
243243
"pylsp.plugins.pycodestyle.select": {
244-
"type": "array",
245-
"default": [],
244+
"type": ["array", "null"],
245+
"default": null,
246246
"items": {
247247
"type": "string"
248248
},
@@ -264,7 +264,7 @@
264264
"description": "Hang closing bracket instead of matching indentation of opening bracket's line."
265265
},
266266
"pylsp.plugins.pycodestyle.maxLineLength": {
267-
"type": ["number", "null"],
267+
"type": ["integer", "null"],
268268
"default": null,
269269
"description": "Set maximum allowed line length."
270270
},
@@ -312,8 +312,8 @@
312312
"description": "Ignore errors and warnings"
313313
},
314314
"pylsp.plugins.pydocstyle.select": {
315-
"type": "array",
316-
"default": [],
315+
"type": ["array", "null"],
316+
"default": null,
317317
"items": {
318318
"type": "string"
319319
},
@@ -370,12 +370,12 @@
370370
"description": "Enable or disable the plugin."
371371
},
372372
"pylsp.rope.extensionModules": {
373-
"type": ["null", "string"],
373+
"type": ["string", "null"],
374374
"default": null,
375375
"description": "Builtin and c-extension modules that are allowed to be imported and inspected by rope."
376376
},
377377
"pylsp.rope.ropeFolder": {
378-
"type": ["null", "array"],
378+
"type": ["array", "null"],
379379
"default": null,
380380
"items": {
381381
"type": "string"

scripts/jsonschema2md.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def describe_type(prop: dict) -> str:
4141
if option in EXTRA_DESCRIPTORS:
4242
parts.append(EXTRA_DESCRIPTORS[option](prop))
4343
if "enum" in prop:
44-
allowed_values = [f"`{value}`" for value in prop["enum"]]
44+
allowed_values = [f"`{value!r}`" for value in prop["enum"]]
4545
parts.append("(one of: " + ", ".join(allowed_values) + ")")
4646
return " ".join(parts)
4747

0 commit comments

Comments
 (0)