Skip to content

Commit eaf53f7

Browse files
authored
Merge pull request #582 from maresb/py-lsp-server
Add Python LSP Server
2 parents d611bc4 + caa8246 commit eaf53f7

File tree

6 files changed

+304
-4
lines changed

6 files changed

+304
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- features:
66

77
- added translation support ([#557], thanks @JessicaBarh)
8+
- add support for python-lsp-server, a community fork of pyls ([#582], thanks @maresb)
89

910
- bug fixes:
1011

@@ -16,6 +17,7 @@
1617
[#570]: https://github.com/krassowski/jupyterlab-lsp/pull/570
1718
[#576]: https://github.com/krassowski/jupyterlab-lsp/pull/576
1819
[#580]: https://github.com/krassowski/jupyterlab-lsp/pull/580
20+
[#582]: https://github.com/krassowski/jupyterlab-lsp/pull/582
1921

2022
### `@krassowski/jupyterlab-lsp 3.5.0` (2020-03-22)
2123

python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from .javascript_typescript_langserver import JavascriptTypescriptLanguageServer
88
from .jedi_language_server import JediLanguageServer
99
from .julia_language_server import JuliaLanguageServer
10-
from .pyls import PythonLanguageServer
10+
from .pyls import PalantirPythonLanguageServer
11+
from .python_lsp_server import PythonLSPServer
1112
from .r_languageserver import RLanguageServer
1213
from .sql_language_server import SQLLanguageServer
1314
from .texlab import Texlab
@@ -25,7 +26,8 @@
2526
json = VSCodeJSONLanguageServer()
2627
julia = JuliaLanguageServer()
2728
md = UnifiedLanguageServer()
28-
py = PythonLanguageServer()
29+
py_palantir = PalantirPythonLanguageServer()
30+
py_lsp_server = PythonLSPServer()
2931
r = RLanguageServer()
3032
tex = Texlab()
3133
ts = JavascriptTypescriptLanguageServer()
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
{
2+
"title": "Python Language Server Configuration",
3+
"type": "object",
4+
"properties": {
5+
"pylsp.executable": {
6+
"type": "string",
7+
"default": "pylsp",
8+
"description": "Language server executable"
9+
},
10+
"pylsp.configurationSources": {
11+
"type": "array",
12+
"default": ["pycodestyle"],
13+
"description": "List of configuration sources to use.",
14+
"items": {
15+
"type": "string",
16+
"enum": ["pycodestyle", "pyflakes"]
17+
},
18+
"uniqueItems": true
19+
},
20+
"pylsp.plugins.jedi_completion.enabled": {
21+
"type": "boolean",
22+
"default": true,
23+
"description": "Enable or disable the plugin."
24+
},
25+
"pylsp.plugins.jedi_completion.include_params": {
26+
"type": "boolean",
27+
"default": true,
28+
"description": "Auto-completes methods and classes with tabstops for each parameter."
29+
},
30+
"pylsp.plugins.jedi_definition.enabled": {
31+
"type": "boolean",
32+
"default": true,
33+
"description": "Enable or disable the plugin."
34+
},
35+
"pylsp.plugins.jedi_definition.follow_imports": {
36+
"type": "boolean",
37+
"default": true,
38+
"description": "The goto call will follow imports."
39+
},
40+
"pylsp.plugins.jedi_definition.follow_builtin_imports": {
41+
"type": "boolean",
42+
"default": true,
43+
"description": "If follow_imports is True will decide if it follow builtin imports."
44+
},
45+
"pylsp.plugins.jedi_hover.enabled": {
46+
"type": "boolean",
47+
"default": true,
48+
"description": "Enable or disable the plugin."
49+
},
50+
"pylsp.plugins.jedi_references.enabled": {
51+
"type": "boolean",
52+
"default": true,
53+
"description": "Enable or disable the plugin."
54+
},
55+
"pylsp.plugins.jedi_signature_help.enabled": {
56+
"type": "boolean",
57+
"default": true,
58+
"description": "Enable or disable the plugin."
59+
},
60+
"pylsp.plugins.jedi_symbols.enabled": {
61+
"type": "boolean",
62+
"default": true,
63+
"description": "Enable or disable the plugin."
64+
},
65+
"pylsp.plugins.jedi_symbols.all_scopes": {
66+
"type": "boolean",
67+
"default": true,
68+
"description": "If True lists the names of all scopes instead of only the module namespace."
69+
},
70+
"pylsp.plugins.mccabe.enabled": {
71+
"type": "boolean",
72+
"default": true,
73+
"description": "Enable or disable the plugin."
74+
},
75+
"pylsp.plugins.mccabe.threshold": {
76+
"type": "number",
77+
"default": 15,
78+
"description": "The minimum threshold that triggers warnings about cyclomatic complexity."
79+
},
80+
"pylsp.plugins.preload.enabled": {
81+
"type": "boolean",
82+
"default": true,
83+
"description": "Enable or disable the plugin."
84+
},
85+
"pylsp.plugins.preload.modules": {
86+
"type": "array",
87+
"default": null,
88+
"items": {
89+
"type": "string"
90+
},
91+
"uniqueItems": true,
92+
"description": "List of modules to import on startup"
93+
},
94+
"pylsp.plugins.pycodestyle.enabled": {
95+
"type": "boolean",
96+
"default": true,
97+
"description": "Enable or disable the plugin."
98+
},
99+
"pylsp.plugins.pycodestyle.exclude": {
100+
"type": "array",
101+
"default": null,
102+
"items": {
103+
"type": "string"
104+
},
105+
"uniqueItems": true,
106+
"description": "Exclude files or directories which match these patterns."
107+
},
108+
"pylsp.plugins.pycodestyle.filename": {
109+
"type": "array",
110+
"default": null,
111+
"items": {
112+
"type": "string"
113+
},
114+
"uniqueItems": true,
115+
"description": "When parsing directories, only check filenames matching these patterns."
116+
},
117+
"pylsp.plugins.pycodestyle.select": {
118+
"type": "array",
119+
"default": null,
120+
"items": {
121+
"type": "string"
122+
},
123+
"uniqueItems": true,
124+
"description": "Select errors and warnings"
125+
},
126+
"pylsp.plugins.pycodestyle.ignore": {
127+
"type": "array",
128+
"default": null,
129+
"items": {
130+
"type": "string"
131+
},
132+
"uniqueItems": true,
133+
"description": "Ignore errors and warnings"
134+
},
135+
"pylsp.plugins.pycodestyle.hangClosing": {
136+
"type": "boolean",
137+
"default": null,
138+
"description": "Hang closing bracket instead of matching indentation of opening bracket's line."
139+
},
140+
"pylsp.plugins.pycodestyle.maxLineLength": {
141+
"type": "number",
142+
"default": null,
143+
"description": "Set maximum allowed line length."
144+
},
145+
"pylsp.plugins.pydocstyle.enabled": {
146+
"type": "boolean",
147+
"default": false,
148+
"description": "Enable or disable the plugin."
149+
},
150+
"pylsp.plugins.pydocstyle.convention": {
151+
"type": "string",
152+
"default": null,
153+
"enum": ["pep257", "numpy"],
154+
"description": "Choose the basic list of checked errors by specifying an existing convention."
155+
},
156+
"pylsp.plugins.pydocstyle.addIgnore": {
157+
"type": "array",
158+
"default": null,
159+
"items": {
160+
"type": "string"
161+
},
162+
"uniqueItems": true,
163+
"description": "Ignore errors and warnings in addition to the specified convention."
164+
},
165+
"pylsp.plugins.pydocstyle.addSelect": {
166+
"type": "array",
167+
"default": null,
168+
"items": {
169+
"type": "string"
170+
},
171+
"uniqueItems": true,
172+
"description": "Select errors and warnings in addition to the specified convention."
173+
},
174+
"pylsp.plugins.pydocstyle.ignore": {
175+
"type": "array",
176+
"default": null,
177+
"items": {
178+
"type": "string"
179+
},
180+
"uniqueItems": true,
181+
"description": "Ignore errors and warnings"
182+
},
183+
"pylsp.plugins.pydocstyle.select": {
184+
"type": "array",
185+
"default": null,
186+
"items": {
187+
"type": "string"
188+
},
189+
"uniqueItems": true,
190+
"description": "Select errors and warnings"
191+
},
192+
"pylsp.plugins.pydocstyle.match": {
193+
"type": "string",
194+
"default": "(?!test_).*\\.py",
195+
"description": "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'."
196+
},
197+
"pylsp.plugins.pydocstyle.matchDir": {
198+
"type": "string",
199+
"default": "[^\\.].*",
200+
"description": "Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot."
201+
},
202+
"pylsp.plugins.pyflakes.enabled": {
203+
"type": "boolean",
204+
"default": true,
205+
"description": "Enable or disable the plugin."
206+
},
207+
"pylsp.plugins.pylint.enabled": {
208+
"type": "boolean",
209+
"default": true,
210+
"description": "Enable or disable the plugin."
211+
},
212+
"pylsp.plugins.pylint.args": {
213+
"type": "array",
214+
"default": null,
215+
"items": {
216+
"type": "string"
217+
},
218+
"uniqueItems": false,
219+
"description": "Arguments to pass to pylint."
220+
},
221+
"pylsp.plugins.rope_completion.enabled": {
222+
"type": "boolean",
223+
"default": true,
224+
"description": "Enable or disable the plugin."
225+
},
226+
"pylsp.plugins.yapf.enabled": {
227+
"type": "boolean",
228+
"default": true,
229+
"description": "Enable or disable the plugin."
230+
},
231+
"pylsp.rope.extensionModules": {
232+
"type": "string",
233+
"default": null,
234+
"description": "Builtin and c-extension modules that are allowed to be imported and inspected by rope."
235+
},
236+
"pylsp.rope.ropeFolder": {
237+
"type": "array",
238+
"default": null,
239+
"items": {
240+
"type": "string"
241+
},
242+
"uniqueItems": true,
243+
"description": "The name of the folder in which rope stores project configurations and data. Pass `null` for not using such a folder at all."
244+
}
245+
}
246+
}

python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .utils import PythonModuleSpec
33

44

5-
class PythonLanguageServer(PythonModuleSpec):
5+
class PalantirPythonLanguageServer(PythonModuleSpec):
66
python_module = key = "pyls"
77
languages = ["python"]
88
spec = dict(
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from .config import load_config_schema
2+
from .utils import PythonModuleSpec
3+
4+
5+
class PythonLSPServer(PythonModuleSpec):
6+
python_module = key = "python-lsp-server"
7+
languages = ["python"]
8+
spec = dict(
9+
display_name="python-lsp-server",
10+
mime_types=["text/python", "text/x-ipython"],
11+
urls=dict(
12+
home="https://github.com/python-lsp/python-lsp-server",
13+
issues="https://github.com/python-lsp/python-lsp-server/issues",
14+
),
15+
install=dict(
16+
pip="pip install 'python-lsp-server[all]'",
17+
conda="conda install -c conda-forge python-lsp-server",
18+
),
19+
extend=[
20+
dict(
21+
display_name="pyls-mypy",
22+
install=dict(
23+
pip="pip install pyls-mypy", conda="conda install pyls-mypy"
24+
),
25+
),
26+
dict(
27+
display_name="pyls-black",
28+
install=dict(
29+
pip="pip install pyls-black", conda="conda install pyls-black"
30+
),
31+
),
32+
dict(
33+
display_name="pyls-isort",
34+
install=dict(
35+
pip="pip install pyls-isort",
36+
conda="conda install pyls-isort",
37+
),
38+
),
39+
dict(
40+
display_name="pyls-memestra",
41+
install=dict(
42+
pip="pip install pyls-memestra",
43+
conda="conda install pyls-memestra",
44+
),
45+
),
46+
],
47+
config_schema=load_config_schema(key),
48+
env=dict(PYTHONUNBUFFERED="1"),
49+
)

python_packages/jupyter_lsp/setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jupyter_lsp_spec_v1 =
3939
javascript-typescript-langserver = jupyter_lsp.specs:ts
4040
jedi-language-server = jupyter_lsp.specs:jedi
4141
julia-language-server = jupyter_lsp.specs:julia
42-
python-language-server = jupyter_lsp.specs:py
42+
python-language-server = jupyter_lsp.specs:py_palantir
43+
python-lsp-server = jupyter_lsp.specs:py_lsp_server
4344
r-languageserver = jupyter_lsp.specs:r
4445
texlab = jupyter_lsp.specs:tex
4546
sql-language-server = jupyter_lsp.specs:sql

0 commit comments

Comments
 (0)