Skip to content

Commit 6c9aca4

Browse files
authored
Specify relevant document path when retrieving some plugin settings (#845)
1 parent e0f8b3d commit 6c9aca4

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

pyls/plugins/autopep8_format.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def pyls_format_range(config, document, range): # pylint: disable=redefined-bui
2828

2929

3030
def _format(config, document, line_range=None):
31-
options = _autopep8_config(config)
31+
options = _autopep8_config(config, document)
3232
if line_range:
3333
options['line_range'] = list(line_range)
3434

@@ -57,9 +57,10 @@ def _format(config, document, line_range=None):
5757
}]
5858

5959

60-
def _autopep8_config(config):
60+
def _autopep8_config(config, document=None):
6161
# We user pycodestyle settings to avoid redefining things
62-
settings = config.plugin_settings('pycodestyle')
62+
path = document.path if document is not None else None
63+
settings = config.plugin_settings('pycodestyle', document_path=path)
6364
options = {
6465
'exclude': settings.get('exclude'),
6566
'hang_closing': settings.get('hangClosing'),

pyls/plugins/flake8_lint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def pyls_settings():
1919
@hookimpl
2020
def pyls_lint(workspace, document):
2121
config = workspace._config
22-
settings = config.plugin_settings('flake8')
22+
settings = config.plugin_settings('flake8', document_path=document.path)
2323
log.debug("Got flake8 settings: %s", settings)
2424

2525
opts = {

pyls/plugins/mccabe_lint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@hookimpl
1414
def pyls_lint(config, document):
15-
threshold = config.plugin_settings('mccabe').get(THRESHOLD, DEFAULT_THRESHOLD)
15+
threshold = config.plugin_settings('mccabe', document_path=document.path).get(THRESHOLD, DEFAULT_THRESHOLD)
1616
log.debug("Running mccabe lint with threshold: %s", threshold)
1717

1818
try:

pyls/plugins/pycodestyle_lint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@hookimpl
2222
def pyls_lint(workspace, document):
2323
config = workspace._config
24-
settings = config.plugin_settings('pycodestyle')
24+
settings = config.plugin_settings('pycodestyle', document_path=document.path)
2525
log.debug("Got pycodestyle settings: %s", settings)
2626

2727
opts = {

pyls/plugins/pydocstyle_lint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def pyls_settings():
2626

2727
@hookimpl
2828
def pyls_lint(config, document):
29-
settings = config.plugin_settings('pydocstyle')
29+
settings = config.plugin_settings('pydocstyle', document_path=document.path)
3030
log.debug("Got pydocstyle settings: %s", settings)
3131

3232
# Explicitly passing a path to pydocstyle means it doesn't respect the --match flag, so do it ourselves

0 commit comments

Comments
 (0)