Skip to content

Commit 36da024

Browse files
committed
Add jedi lint plugin
1 parent e9c7e9b commit 36da024

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

pyls/plugins/jedi_lint.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pyls import hookimpl, lsp
2+
3+
@hookimpl
4+
def pyls_lint(config, document):
5+
errors = document.jedi_script().get_syntax_errors()
6+
diagnostics = []
7+
8+
for error in errors:
9+
err_range = {
10+
'start': {
11+
'line': error.line - 1,
12+
# Index columns start from 0
13+
'character': error.column,
14+
},
15+
'end': {
16+
'line': error.until_line - 1,
17+
# It's possible that we're linting an empty file. Even an empty
18+
# file might fail linting if it isn't named properly.
19+
'character': error.until_column,
20+
},
21+
}
22+
diagnostics.append({
23+
'source': 'jedi',
24+
'range': err_range,
25+
'message': error.get_message(),
26+
'severity': lsp.DiagnosticSeverity.Error,
27+
})
28+
return diagnostics

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
'jedi_rename = pyls.plugins.jedi_rename',
9898
'jedi_signature_help = pyls.plugins.signature',
9999
'jedi_symbols = pyls.plugins.symbols',
100+
'jedi_lint = pyls.plugins.jedi_lint',
100101
'mccabe = pyls.plugins.mccabe_lint',
101102
'preload = pyls.plugins.preload_imports',
102103
'pycodestyle = pyls.plugins.pycodestyle_lint',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy