diff --git a/CHANGELOG.md b/CHANGELOG.md index d76ab32c3..2c33168bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: @@ -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) diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py b/python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py index 40ca3e38b..ecd6f4232 100644 --- a/python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py @@ -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 @@ -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() diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/config/python-lsp-server.schema.json b/python_packages/jupyter_lsp/jupyter_lsp/specs/config/python-lsp-server.schema.json new file mode 100644 index 000000000..b2ca0b8ee --- /dev/null +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/config/python-lsp-server.schema.json @@ -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." + } + } +} diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py b/python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py index bf1ca2938..d9ca518de 100644 --- a/python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/pyls.py @@ -2,7 +2,7 @@ from .utils import PythonModuleSpec -class PythonLanguageServer(PythonModuleSpec): +class PalantirPythonLanguageServer(PythonModuleSpec): python_module = key = "pyls" languages = ["python"] spec = dict( diff --git a/python_packages/jupyter_lsp/jupyter_lsp/specs/python_lsp_server.py b/python_packages/jupyter_lsp/jupyter_lsp/specs/python_lsp_server.py new file mode 100644 index 000000000..d04eac88c --- /dev/null +++ b/python_packages/jupyter_lsp/jupyter_lsp/specs/python_lsp_server.py @@ -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"), + ) diff --git a/python_packages/jupyter_lsp/setup.cfg b/python_packages/jupyter_lsp/setup.cfg index d027a1a18..4dddd261d 100644 --- a/python_packages/jupyter_lsp/setup.cfg +++ b/python_packages/jupyter_lsp/setup.cfg @@ -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