Skip to content

Commit

Permalink
Merge pull request #582 from maresb/py-lsp-server
Browse files Browse the repository at this point in the history
Add Python LSP Server
  • Loading branch information
krassowski authored Apr 25, 2021
2 parents d611bc4 + caa8246 commit eaf53f7
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- features:

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

- bug fixes:

Expand All @@ -16,6 +17,7 @@
[#570]: https://github.com/krassowski/jupyterlab-lsp/pull/570
[#576]: https://github.com/krassowski/jupyterlab-lsp/pull/576
[#580]: https://github.com/krassowski/jupyterlab-lsp/pull/580
[#582]: https://github.com/krassowski/jupyterlab-lsp/pull/582

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

Expand Down
6 changes: 4 additions & 2 deletions python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from .javascript_typescript_langserver import JavascriptTypescriptLanguageServer
from .jedi_language_server import JediLanguageServer
from .julia_language_server import JuliaLanguageServer
from .pyls import PythonLanguageServer
from .pyls import PalantirPythonLanguageServer
from .python_lsp_server import PythonLSPServer
from .r_languageserver import RLanguageServer
from .sql_language_server import SQLLanguageServer
from .texlab import Texlab
Expand All @@ -25,7 +26,8 @@
json = VSCodeJSONLanguageServer()
julia = JuliaLanguageServer()
md = UnifiedLanguageServer()
py = PythonLanguageServer()
py_palantir = PalantirPythonLanguageServer()
py_lsp_server = PythonLSPServer()
r = RLanguageServer()
tex = Texlab()
ts = JavascriptTypescriptLanguageServer()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"title": "Python Language Server Configuration",
"type": "object",
"properties": {
"pylsp.executable": {
"type": "string",
"default": "pylsp",
"description": "Language server executable"
},
"pylsp.configurationSources": {
"type": "array",
"default": ["pycodestyle"],
"description": "List of configuration sources to use.",
"items": {
"type": "string",
"enum": ["pycodestyle", "pyflakes"]
},
"uniqueItems": true
},
"pylsp.plugins.jedi_completion.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_completion.include_params": {
"type": "boolean",
"default": true,
"description": "Auto-completes methods and classes with tabstops for each parameter."
},
"pylsp.plugins.jedi_definition.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_definition.follow_imports": {
"type": "boolean",
"default": true,
"description": "The goto call will follow imports."
},
"pylsp.plugins.jedi_definition.follow_builtin_imports": {
"type": "boolean",
"default": true,
"description": "If follow_imports is True will decide if it follow builtin imports."
},
"pylsp.plugins.jedi_hover.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_references.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_signature_help.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_symbols.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.jedi_symbols.all_scopes": {
"type": "boolean",
"default": true,
"description": "If True lists the names of all scopes instead of only the module namespace."
},
"pylsp.plugins.mccabe.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.mccabe.threshold": {
"type": "number",
"default": 15,
"description": "The minimum threshold that triggers warnings about cyclomatic complexity."
},
"pylsp.plugins.preload.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.preload.modules": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "List of modules to import on startup"
},
"pylsp.plugins.pycodestyle.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.pycodestyle.exclude": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Exclude files or directories which match these patterns."
},
"pylsp.plugins.pycodestyle.filename": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "When parsing directories, only check filenames matching these patterns."
},
"pylsp.plugins.pycodestyle.select": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Select errors and warnings"
},
"pylsp.plugins.pycodestyle.ignore": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Ignore errors and warnings"
},
"pylsp.plugins.pycodestyle.hangClosing": {
"type": "boolean",
"default": null,
"description": "Hang closing bracket instead of matching indentation of opening bracket's line."
},
"pylsp.plugins.pycodestyle.maxLineLength": {
"type": "number",
"default": null,
"description": "Set maximum allowed line length."
},
"pylsp.plugins.pydocstyle.enabled": {
"type": "boolean",
"default": false,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.pydocstyle.convention": {
"type": "string",
"default": null,
"enum": ["pep257", "numpy"],
"description": "Choose the basic list of checked errors by specifying an existing convention."
},
"pylsp.plugins.pydocstyle.addIgnore": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Ignore errors and warnings in addition to the specified convention."
},
"pylsp.plugins.pydocstyle.addSelect": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Select errors and warnings in addition to the specified convention."
},
"pylsp.plugins.pydocstyle.ignore": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Ignore errors and warnings"
},
"pylsp.plugins.pydocstyle.select": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Select errors and warnings"
},
"pylsp.plugins.pydocstyle.match": {
"type": "string",
"default": "(?!test_).*\\.py",
"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'."
},
"pylsp.plugins.pydocstyle.matchDir": {
"type": "string",
"default": "[^\\.].*",
"description": "Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot."
},
"pylsp.plugins.pyflakes.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.pylint.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.pylint.args": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": false,
"description": "Arguments to pass to pylint."
},
"pylsp.plugins.rope_completion.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.plugins.yapf.enabled": {
"type": "boolean",
"default": true,
"description": "Enable or disable the plugin."
},
"pylsp.rope.extensionModules": {
"type": "string",
"default": null,
"description": "Builtin and c-extension modules that are allowed to be imported and inspected by rope."
},
"pylsp.rope.ropeFolder": {
"type": "array",
"default": null,
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "The name of the folder in which rope stores project configurations and data. Pass `null` for not using such a folder at all."
}
}
}
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .utils import PythonModuleSpec


class PythonLanguageServer(PythonModuleSpec):
class PalantirPythonLanguageServer(PythonModuleSpec):
python_module = key = "pyls"
languages = ["python"]
spec = dict(
Expand Down
49 changes: 49 additions & 0 deletions python_packages/jupyter_lsp/jupyter_lsp/specs/python_lsp_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from .config import load_config_schema
from .utils import PythonModuleSpec


class PythonLSPServer(PythonModuleSpec):
python_module = key = "python-lsp-server"
languages = ["python"]
spec = dict(
display_name="python-lsp-server",
mime_types=["text/python", "text/x-ipython"],
urls=dict(
home="https://github.com/python-lsp/python-lsp-server",
issues="https://github.com/python-lsp/python-lsp-server/issues",
),
install=dict(
pip="pip install 'python-lsp-server[all]'",
conda="conda install -c conda-forge python-lsp-server",
),
extend=[
dict(
display_name="pyls-mypy",
install=dict(
pip="pip install pyls-mypy", conda="conda install pyls-mypy"
),
),
dict(
display_name="pyls-black",
install=dict(
pip="pip install pyls-black", conda="conda install pyls-black"
),
),
dict(
display_name="pyls-isort",
install=dict(
pip="pip install pyls-isort",
conda="conda install pyls-isort",
),
),
dict(
display_name="pyls-memestra",
install=dict(
pip="pip install pyls-memestra",
conda="conda install pyls-memestra",
),
),
],
config_schema=load_config_schema(key),
env=dict(PYTHONUNBUFFERED="1"),
)
3 changes: 2 additions & 1 deletion python_packages/jupyter_lsp/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jupyter_lsp_spec_v1 =
javascript-typescript-langserver = jupyter_lsp.specs:ts
jedi-language-server = jupyter_lsp.specs:jedi
julia-language-server = jupyter_lsp.specs:julia
python-language-server = jupyter_lsp.specs:py
python-language-server = jupyter_lsp.specs:py_palantir
python-lsp-server = jupyter_lsp.specs:py_lsp_server
r-languageserver = jupyter_lsp.specs:r
texlab = jupyter_lsp.specs:tex
sql-language-server = jupyter_lsp.specs:sql
Expand Down

0 comments on commit eaf53f7

Please sign in to comment.