Skip to content

Commit

Permalink
Support pycodestyle indent-size option (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnauw authored Dec 31, 2021
1 parent 7b98f9f commit ee7a52b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This server can be configured using `workspace/didChangeConfiguration` method. E
| `pylsp.plugins.flake8.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` |
| `pylsp.plugins.flake8.ignore` | `array` | List of errors and warnings to ignore (or skip). | `null` |
| `pylsp.plugins.flake8.maxLineLength` | `integer` | Maximum allowed line length for the entirety of this run. | `null` |
| `pylsp.plugins.flake8.indentSize` | `integer` | Set indentation spaces. | `null` |
| `pylsp.plugins.flake8.perFileIgnores` | `array` | A pairing of filenames and violation codes that defines which violations to ignore in a particular file, for example: `["file_path.py:W305,W304"]`). | `null` |
| `pylsp.plugins.flake8.select` | `array` | List of errors and warnings to enable. | `null` |
| `pylsp.plugins.jedi.extra_paths` | `array` | Define extra paths for jedi.Script. | `[]` |
Expand Down Expand Up @@ -44,6 +45,7 @@ This server can be configured using `workspace/didChangeConfiguration` method. E
| `pylsp.plugins.pycodestyle.ignore` | `array` of unique `string` items | Ignore errors and warnings | `null` |
| `pylsp.plugins.pycodestyle.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` |
| `pylsp.plugins.pycodestyle.maxLineLength` | `number` | Set maximum allowed line length. | `null` |
| `pylsp.plugins.pycodestyle.indentSize` | `integer` | Set indentation spaces. | `null` |
| `pylsp.plugins.pydocstyle.enabled` | `boolean` | Enable or disable the plugin. | `false` |
| `pylsp.plugins.pydocstyle.convention` | `string` | Choose the basic list of checked errors by specifying an existing convention. | `null` |
| `pylsp.plugins.pydocstyle.addIgnore` | `array` of unique `string` items | Ignore errors and warnings in addition to the specified convention. | `null` |
Expand Down
2 changes: 2 additions & 0 deletions pylsp/config/flake8_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
('hang-closing', 'plugins.pycodestyle.hangClosing', bool),
('ignore', 'plugins.pycodestyle.ignore', list),
('max-line-length', 'plugins.pycodestyle.maxLineLength', int),
('indent-size', 'plugins.pycodestyle.indentSize', int),
('select', 'plugins.pycodestyle.select', list),
# flake8
('exclude', 'plugins.flake8.exclude', list),
('filename', 'plugins.flake8.filename', list),
('hang-closing', 'plugins.flake8.hangClosing', bool),
('ignore', 'plugins.flake8.ignore', list),
('max-line-length', 'plugins.flake8.maxLineLength', int),
('indent-size', 'plugins.flake8.indentSize', int),
('select', 'plugins.flake8.select', list),
('per-file-ignores', 'plugins.flake8.perFileIgnores', list),
]
Expand Down
1 change: 1 addition & 0 deletions pylsp/config/pycodestyle_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
('hang-closing', 'plugins.pycodestyle.hangClosing', bool),
('ignore', 'plugins.pycodestyle.ignore', list),
('max-line-length', 'plugins.pycodestyle.maxLineLength', int),
('indent-size', 'plugins.pycodestyle.indentSize', int),
('select', 'plugins.pycodestyle.select', list),
('aggressive', 'plugins.pycodestyle.aggressive', int),
]
Expand Down
10 changes: 10 additions & 0 deletions pylsp/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"default": null,
"description": "Maximum allowed line length for the entirety of this run."
},
"pylsp.plugins.flake8.indentSize": {
"type": "integer",
"default": null,
"description": "Set indentation spaces."
},
"pylsp.plugins.flake8.perFileIgnores": {
"type": "array",
"default": null,
Expand Down Expand Up @@ -237,6 +242,11 @@
"default": null,
"description": "Set maximum allowed line length."
},
"pylsp.plugins.pycodestyle.indentSize": {
"type": "integer",
"default": null,
"description": "Set indentation spaces."
},
"pylsp.plugins.pydocstyle.enabled": {
"type": "boolean",
"default": false,
Expand Down
1 change: 1 addition & 0 deletions pylsp/plugins/flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def pylsp_lint(workspace, document):
'hang-closing': settings.get('hangClosing'),
'ignore': ignores or None,
'max-line-length': settings.get('maxLineLength'),
'indent-size': settings.get('indentSize'),
'select': settings.get('select'),
}

Expand Down
1 change: 1 addition & 0 deletions pylsp/plugins/pycodestyle_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def pylsp_lint(workspace, document):
'hang_closing': settings.get('hangClosing'),
'ignore': settings.get('ignore'),
'max_line_length': settings.get('maxLineLength'),
'indent_size': settings.get('indentSize'),
'select': settings.get('select'),
}
kwargs = {k: v for k, v in opts.items() if v}
Expand Down

0 comments on commit ee7a52b

Please sign in to comment.