-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from maresb/py-lsp-server
Add Python LSP Server
- Loading branch information
Showing
6 changed files
with
304 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
246 changes: 246 additions & 0 deletions
246
python_packages/jupyter_lsp/jupyter_lsp/specs/config/python-lsp-server.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
python_packages/jupyter_lsp/jupyter_lsp/specs/python_lsp_server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters