sublimelsp / lsp-pylsp Goto Github PK
View Code? Open in Web Editor NEWConvenience package for the Python Language Server
License: MIT License
Convenience package for the Python Language Server
License: MIT License
I would like configure the default jedi environment like this:
{
"settings": {
"pylsp.plugins.jedi.environment": "~/.virtualenvs/${project_base_name}",
}
}
However, the plugin does not expand "~" into my home directory path. Could an expandpath be added on the settings variables that hold a path? (I don't know how to do that, otherwise I would have filed a pull request)
I'm on SublimeText 4169. I've just upgraded SublimeText because I started getting LSP-pylsp failures last month (see error below).
As far as I understand, mypy 1.8.0 is not available for python 3.3. And the newest SublimeText plugin API should be python 3.8. However, when I uninstall and re-install LSP-pylsp, it appears to be installing via python 3.3:
Package Control: Installed package "LSP-pylsp" 2.18.0
reloading settings Packages/LSP-pylsp/LSP-pylsp.sublime-settings
reloading python 3.3 plugin LSP-pylsp.plugin
The error that popups once the plugin is loaded:
--- Error: ---
Error installing the server:
Collecting mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1))
Could not find a version that satisfies the requirement mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1)) (from versions: 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.221, 0.222, 0.223, 0.224, 0.225, 0.226, 0.227, 0.228, 0.229, 0.230, 0.231, 0.232, 0.233, 0.234, 0.235, 0.236, 0.237, 0.238, 0.239, 0.240, 0.241, 0.250, 0.251, 0.252, 0.253, 0.254, 0.255, 0.256, 0.470, 0.471, 0.501, 0.510, 0.511, 0.520, 0.521, 0.530, 0.540, 0.550, 0.560, 0.570, 0.580, 0.590, 0.600, 0.610, 0.620, 0.630, 0.641, 0.650, 0.660, 0.670, 0.700, 0.701, 0.710, 0.711, 0.720, 0.730, 0.740, 0.750, 0.760, 0.761, 0.770, 0.780, 0.781, 0.782, 0.790, 0.800, 0.812, 0.900, 0.901, 0.902, 0.910, 0.920, 0.921, 0.930, 0.931, 0.940, 0.941, 0.942, 0.950, 0.960, 0.961, 0.971, 0.981, 0.982, 0.990, 0.991, 1.0.0, 1.0.1, 1.1.1, 1.2.0, 1.3.0, 1.4.0, 1.4.1)
No matching distribution found for mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1))
My python has updated through brew
and now I'm getting this:
I haven't tried fixing it yet but it's not a great message to show in the user's face.
According to allenai/document-qa#47 I might have to install some dependencies globally but that doesn't sound like a good solution.
Hi,
I recently started having the issue shown below, and I'm not sure how to troubleshoot further.
Traceback (most recent call last):
File "C:\local\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\local\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\local\st3\Data\Package Storage\LSP-pylsp\Scripts\pylsp.exe\__main__.py", line 5, in <module>
File "c:\local\st3\data\package storage\lsp-pylsp\lib\site-packages\pylsp\__main__.py", line 15, in <module>
from .python_lsp import (PythonLSPServer, start_io_lang_server,
File "c:\local\st3\data\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 15, in <module>
from . import lsp, _utils, uris
File "c:\local\st3\data\package storage\lsp-pylsp\lib\site-packages\pylsp\_utils.py", line 13, in <module>
import docstring_to_markdown
ModuleNotFoundError: No module named 'docstring_to_markdown'
[
"$server_path"
]
"C:\local\st3\Data\Package Storage\LSP-pylsp\Scripts\pylsp.exe"
source.python
(source.python)
{}
{
"pylsp": {
"configurationSources": [
"pycodestyle"
],
"plugins": {
"autopep8": {
"enabled": true
},
"flake8": {
"config": null,
"enabled": false,
"exclude": null,
"executable": "flake8",
"filename": null,
"hangClosing": null,
"ignore": null,
"maxLineLength": 120,
"perFileIgnores": null,
"select": null
},
"jedi": {
"auto_import_modules": [
"numpy"
],
"env_vars": null,
"environment": null,
"extra_paths": [
"$sublime_py_files_dir",
"$packages"
]
},
"jedi_completion": {
"cache_for": [
"pandas",
"numpy",
"tensorflow",
"matplotlib"
],
"eager": false,
"enabled": false,
"fuzzy": true,
"include_class_objects": false,
"include_function_objects": false,
"include_params": true,
"resolve_at_most": 25
},
"jedi_definition": {
"enabled": false,
"follow_builtin_imports": true,
"follow_imports": true
},
"jedi_hover": {
"enabled": false
},
"jedi_references": {
"enabled": false
},
"jedi_signature_help": {
"enabled": false
},
"jedi_symbols": {
"all_scopes": true,
"enabled": false,
"include_import_symbols": true
},
"mccabe": {
"enabled": true,
"threshold": 15
},
"preload": {
"enabled": true,
"modules": null
},
"pycodestyle": {
"aggressive": 1,
"enabled": true,
"exclude": null,
"filename": null,
"hangClosing": null,
"ignore": null,
"maxLineLength": 120,
"select": null
},
"pydocstyle": {
"addIgnore": null,
"addSelect": null,
"convention": null,
"enabled": false,
"ignore": null,
"match": "(?!test_).*\\.py",
"matchDir": "[^\\.].*",
"select": null
},
"pyflakes": {
"enabled": false
},
"pylint": {
"args": null,
"enabled": false,
"executable": ""
},
"pyls_isort": {
"enabled": true
},
"pylsp_black": {
"cache_config": false,
"enabled": false,
"line_length": 120,
"preview": false
},
"pylsp_mypy": {
"dmypy": false,
"enabled": false,
"live_mode": false,
"strict": false
},
"rope_completion": {
"eager": false,
"enabled": false
},
"yapf": {
"enabled": false
}
},
"rope": {
"extensionModules": null,
"ropeFolder": null
}
}
}
{
"HTTPS_PROXY": "http://x.x.x.x:xx",
"HTTP_PROXY": "http://x.x.x.x:xx",
"PATH": "C:\\local\\st3\\Data\\Package Storage\\LSP-pylsp\\Scripts;",
"PYTHONPATH": "${sublime_py_files_dir}${pathsep}${packages}"
}
Z:\home\...
{
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
"lsp_active": true,
"syntax": "Packages/MagicPython/grammars/MagicPython.tmLanguage"
}
source.python
[
"Z:\\home\\..."
]
{
"folders": [
{
"path": "."
}
]
}
for example if I import lxml which is a package installed via pip to ~/.local. the goto does not work on the functions in lxml. Is this expected limitation or something can be configured?
tox.ini
is not considered by flake8pycodestyle
is triggered despite the fact that I set its settings to false
I tried several methods but nothing works. A simple test with an E501 error because triggers:
13:80 warning E501 line too long (80 > 79 characters) pycodestyle:E501
13:80 warning E501 line too long (80 > 79 characters) flake8:E501
Despite the fact that my tox.ini is configured like this:
[flake8]
ignore = E226,E302,E41
max-line-length = 120
{
"clients": {
"pylsp": {
"enabled": false,
"selector": "source.python",
"settings": {
"pylsp.plugins.pyflakes.enabled": false,
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.flake8.enabled": true,
"pylsp.configurationSources": ["flake8"],
"pylsp.plugins.jedi_rename.enabled": true,
"pylsp.plugins.autopep8.enabled": false,
"pylsp.plugins.yapf.enabled": false,
"pylsp.plugins.black.enabled": true,
"pylsp.plugins.mypy_ls.enabled": true
}}}}
{
"pylsp.plugins.mypy-ls.enabled": true,
"pylsp.plugins.flake8.enabled": true,
"pylsp.configurationSources": [ "flake8"],
"pylsp.plugins.pyls_black.enabled": true,
"pylsp.plugins.flake8.config": "~/.config/flake8/tox.ini"
}
{
"folders": [
{
"path": ".",
},
],
"settings": {
"python_interpreter": "~/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/python3",
"LSP": {
"pylsp": {
"enabled": true,
"command": [
"~/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/pylsp",
],
"settings": {
"pylsp.plugins.flake8.executable": "~/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/flake8",
},
},
},
},
"build_systems": [
{
"name": "Base Python Build",
"cmd": [
"~/Library/Caches/pypoetry/virtualenvs/base-hkX03Jqr-py3.10/bin/python3",
"-u",
"$file"
],
"selector": "source.python",
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)",
}
],
}
All is working great, linting, mypy hints etc. but my linting prefs via flake8 config file is not impacting the error.
EDIT: with a minimal description of my python env managed by Poetry and with python-lsp-server[all]
, python-lsp-black
, mypy-ls
and pyls-isort
added.
Hey! Trying to use LSP-pyls in a project, I can get code completion working, but not any of the linters
User settings file
// Settings in here override those in "LSP-pyls/LSP-pyls.sublime-settings"
{
"settings": {
"pyls.configurationSources": ["flake8"],
"pyls.plugins.pycodestyle.enabled": false,
"pyls.plugins.flake8_lint.enabled": true,
"pyls.plugins.pyls_mypy.enabled": true,
"pyls.plugins.pyls_mypy.live_mode": false,
"pyls.plugins.pyls_black.enabled": true,
"pyls.plugins.pyls_isort.enabled": true,
},
}
To get mypy/flake8 warnings/diagnostics shown in Sublime.
Renames, code-completion and go-to-reference is working, the things I expect are depending on JEDI.
Enabling the different linters from the overall lsp settings under the pyls key, the lsp-pyls settings, and project settings.
Since I'm using poetry, I thought something might be up with the PATH vars, to I tried adding the env section to these different locations as well, but it didn't work either.
"env": {
"PYTHONPATH": "$sublime_py_files_dir:$packages:/Users/username/Library/Caches/pypoetry/virtualenvs/backend-GAy6QZlK-py3.8",
"MYPY_PATH": "$sublime_py_files_dir:$packages:/Users/username/Library/Caches/pypoetry/virtualenvs/backend-GAy6QZlK-py3.8"
},
I am using autopep8
as formatter. I want to have a custom configuration for autopep8
. Where exactly do I put my configurations into ? Can I put key-values like this somewhere in LSP.sublime-settings
Or LSP-pylsp.sublime-settings
file (or maybe in project specific "settings": { }
) ?
I am quite new to sublime, so sorry if the question is basic.
Configuration of my project:
{
"folders": [
{
"path": "."
}
],
"settings": {
"LSP": {
"LSP-pylsp": {
"settings": {
"pylsp.plugins.jedi.environment": "/Users/thepoy/venvs/spider"
}
}
},
}
}
Although there is no error or exception thrown, none of the packages in the virtual environment can be prompted or automatically completed.
Virtual environment directory structure:
.
├── bin
├── include
├── lib
│ └── python3.8
│ └── site-packages
└── share
It can be seen that it is a virtual environment generated by python3-venv
.
I saw that the versions are stored in the sublime-settings file.
Is it possible to add requirements.txt file for dependencies?
Please add support for the ruff Python linter. Unless it's not documented, I don't see it in the list of supported linters for pylsp.
I am picking up work on a Python project again and now I get an exception in the pylsp service. From what I remember everything was working just fine two months ago, during I did not touch this environment. However, there obviously were package updates on the Sublime Text side.
Anyways, any ideas on how to debug and figure out what could be going wrong? Maybe this issue should be reported on the jedi side of things?
// Settings in here override those in "LSP-pylsp/LSP-pylsp.sublime-settings"
{
"settings": {
"pylsp.plugins.autopep8.enabled": false,
"pylsp.plugins.pylsp_black.enabled": true,
"pylsp.plugins.pyls_isort.enabled": true,
"pylsp.plugins.jedi.environment": ".\\venv",
// Pycodestyle settings
"pylsp.plugins.pycodestyle.ignore": ["E501", "W503", "E203"],
"pylsp.plugins.pycodestyle.exclude": ["venv\\**"]
}
}
:: -> LSP-pylsp textDocument/didChange: <params with 14255 characters>
LSP-pylsp: 2021-08-23 09:32:02,756 W. Europe Daylight Time - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 219
LSP-pylsp: Traceback (most recent call last):
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\cache.py", line 110, in wrapper
LSP-pylsp: return dct[key]
LSP-pylsp: KeyError: ((), frozenset())
LSP-pylsp:
LSP-pylsp: During handling of the above exception, another exception occurred:
LSP-pylsp:
LSP-pylsp: Traceback (most recent call last):
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\api\environment.py", line 77, in _get_subprocess
LSP-pylsp: info = self._subprocess._send(None, _get_info)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\inference\compiled\subprocess\__init__.py", line 237, in _send
LSP-pylsp: pickle_dump(data, self._get_process().stdin, PICKLE_PROTOCOL)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\cache.py", line 112, in wrapper
LSP-pylsp: result = method(self, *args, **kwargs)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\inference\compiled\subprocess\__init__.py", line 193, in _get_process
LSP-pylsp: process = _GeneralizedPopen(
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\inference\compiled\subprocess\__init__.py", line 43, in _GeneralizedPopen
LSP-pylsp: return subprocess.Popen(*args, **kwargs)
LSP-pylsp: File "C:\ProgramData\pyenv\pyenv-win\versions\3.9.6\lib\subprocess.py", line 951, in __init__
LSP-pylsp: self._execute_child(args, executable, preexec_fn, close_fds,
LSP-pylsp: File "C:\ProgramData\pyenv\pyenv-win\versions\3.9.6\lib\subprocess.py", line 1420, in _execute_child
LSP-pylsp: hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
LSP-pylsp: OSError: [WinError 87] The parameter is incorrect
LSP-pylsp:
LSP-pylsp: During handling of the above exception, another exception occurred:
LSP-pylsp:
LSP-pylsp: Traceback (most recent call last):
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\endpoint.py", line 116, in consume
LSP-pylsp: self._handle_request(message['id'], message['method'], message.get('params'))
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\endpoint.py", line 185, in _handle_request
LSP-pylsp: handler_result = handler(params)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\dispatchers.py", line 25, in handler
LSP-pylsp: return method(**(params or {}))
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 356, in m_text_document__document_highlight
LSP-pylsp: return self.highlight(textDocument['uri'], position)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 287, in highlight
LSP-pylsp: return flatten(self._hook('pylsp_document_highlight', doc_uri, position=position)) or None
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 156, in _hook
LSP-pylsp: return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\hooks.py", line 286, in __call__
LSP-pylsp: return self._hookexec(self, self.get_hookimpls(), kwargs)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
LSP-pylsp: return self._inner_hookexec(hook, methods, kwargs)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\manager.py", line 337, in traced_hookexec
LSP-pylsp: return outcome.get_result()
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\callers.py", line 80, in get_result
LSP-pylsp: raise ex[1].with_traceback(ex[2])
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\callers.py", line 52, in from_call
LSP-pylsp: result = func()
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\manager.py", line 335, in <lambda>
LSP-pylsp: outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
LSP-pylsp: self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\callers.py", line 208, in _multicall
LSP-pylsp: return outcome.get_result()
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\callers.py", line 80, in get_result
LSP-pylsp: raise ex[1].with_traceback(ex[2])
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pluggy\callers.py", line 187, in _multicall
LSP-pylsp: res = hook_impl.function(*args)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\plugins\highlight.py", line 13, in pylsp_document_highlight
LSP-pylsp: usages = document.jedi_script().get_references(**code_position)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\workspace.py", line 27, in wrapper
LSP-pylsp: return method(self, *args, **kwargs)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\workspace.py", line 265, in jedi_script
LSP-pylsp: environment = self.get_enviroment(environment_path, env_vars=env_vars) if environment_path else None
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\pylsp\workspace.py", line 294, in get_enviroment
LSP-pylsp: environment = jedi.api.environment.create_environment(path=environment_path,
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\api\environment.py", line 367, in create_environment
LSP-pylsp: return Environment(_get_executable_path(path, safe=safe), env_vars=env_vars)
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\api\environment.py", line 68, in __init__
LSP-pylsp: self._get_subprocess()
LSP-pylsp: File "<sublime path>\data\package storage\lsp-pylsp\lib\site-packages\jedi\api\environment.py", line 79, in _get_subprocess
LSP-pylsp: raise InvalidPythonEnvironment(
LSP-pylsp: jedi.api.environment.InvalidPythonEnvironment: Could not get version information for '.\\venv\\Scripts\\python.exe': OSError(22, 'The parameter is incorrect', None, 87, None)
:: <~~ LSP-pylsp 219: {'message': "jedi.api.environment.InvalidPythonEnvironment: Could not get version information for '.\\\\venv\\\\Scripts\\\\python.exe': OSError(22, 'The parameter is incorrect', None, 87, None)", 'code': -32602, 'data': {'traceback': [' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp_jsonrpc\\endpoint.py", line 116, in consume\n self._handle_request(message[\'id\'], message[\'method\'], message.get(\'params\'))\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp_jsonrpc\\endpoint.py", line 185, in _handle_request\n handler_result = handler(params)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp_jsonrpc\\dispatchers.py", line 25, in handler\n return method(**(params or {}))\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\python_lsp.py", line 356, in m_text_document__document_highlight\n return self.highlight(textDocument[\'uri\'], position)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\python_lsp.py", line 287, in highlight\n return flatten(self._hook(\'pylsp_document_highlight\', doc_uri, position=position)) or None\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\python_lsp.py", line 156, in _hook\n return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\hooks.py", line 286, in __call__\n return self._hookexec(self, self.get_hookimpls(), kwargs)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\manager.py", line 93, in _hookexec\n return self._inner_hookexec(hook, methods, kwargs)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\manager.py", line 337, in traced_hookexec\n return outcome.get_result()\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\callers.py", line 80, in get_result\n raise ex[1].with_traceback(ex[2])\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\callers.py", line 52, in from_call\n result = func()\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\manager.py", line 335, in <lambda>\n outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\manager.py", line 84, in <lambda>\n self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\callers.py", line 208, in _multicall\n return outcome.get_result()\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\callers.py", line 80, in get_result\n raise ex[1].with_traceback(ex[2])\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pluggy\\callers.py", line 187, in _multicall\n res = hook_impl.function(*args)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\plugins\\highlight.py", line 13, in pylsp_document_highlight\n usages = document.jedi_script().get_references(**code_position)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\workspace.py", line 27, in wrapper\n return method(self, *args, **kwargs)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\workspace.py", line 265, in jedi_script\n environment = self.get_enviroment(environment_path, env_vars=env_vars) if environment_path else None\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\pylsp\\workspace.py", line 294, in get_enviroment\n environment = jedi.api.environment.create_environment(path=environment_path,\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\jedi\\api\\environment.py", line 367, in create_environment\n return Environment(_get_executable_path(path, safe=safe), env_vars=env_vars)\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\jedi\\api\\environment.py", line 68, in __init__\n self._get_subprocess()\n', ' File "<sublime path>\\data\\package storage\\lsp-pylsp\\lib\\site-packages\\jedi\\api\\environment.py", line 79, in _get_subprocess\n raise InvalidPythonEnvironment(\n']}}
:: <<< LSP-pylsp 220: []
For instance, when specifying a Poetry virtualenv through pylsp.plugins.jedi.environment
, Mypy will not use it, and provide completely broken results.
Additionally, native Poetry support (akin to what vim-ale does) would be a great addition.
Like other LSP packages do, this one should also remove the cache data on plugin_unloaded
so that it cleans after itself when uninstalled or on updating.
I cloned this repo in the packages directory.
I expect the server to start the installation when I open ST, but that is not happening. (and there is no LSP-pyls folder in the cache folder)
When I open sublime, and open the console I can see that the LSP-pyls plugin loaded, and I expect to see LSP-pyls in this section, but I don't see it:
LSP: global configs ['LSP-dockerfile=True', 'LSP-elm=True', 'LSP-html=True', 'pyls=False', 'LSP-typescript=True', 'LSP-eslint=True', 'LSP-intelephense=True', 'LSP-json=True', 'LSP-css=True', 'lsp-lemminx=True', 'LSP-vue=True', 'ruby=False', 'clangd=True', 'jdtls=False', 'rust-analyzer=False', 'golsp=False', 'elixir-ls=False', 'erlang-ls=False', 'flow=False', 'gopls=False', 'dart=False', 'polymer-ide=False', 'rls=True', 'ocaml=False', 'reason=False', 'sorbet=False', 'sourcekit-lsp=False', 'vscode-css=False', 'haskell-ide-engine=False', 'rlang=False']
λ python --version
Python 2.7.17
See
LSP-pylsp/LSP-pylsp.sublime-settings
Line 62 in 81fabfe
flake8
is invalid according to
https://github.com/sublimelsp/LSP-pylsp/blob/master/sublime-package.json#L35-L38
Should it be pyflakes
instead? Flake8 is a wrapper around pyflakes (and more).
I didn't installed ruff, and I don't see it listed by pip3.
But when turned on I'm getting some (not many) complaints about code formatting, like unused variables, too long line etc.
with ruff issue ID like: ruff(F841)
.
I'm trying to understand what is going on here.
Where is the ruff? How can I configure it (add exemptions, etc...). Or maybe these messages don't come from ruff?
It seems that the LSP-pylsp
plugin doesn't support pylsp 1.7.3
yet.
version of the plugin: 2.11.1
Please add support for pylsp version 1.7.3
Failed to start LSP-pylsp - disabling for this window for the duration ofthe current session.
Re-enable by running "LSP: Enable Language Server In Project" from theCommand Palette.
--- ErOr ---
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleCollecting mypy==1.3.0
Using cached
https://pypituna.tsinghua.edu.cn/packages/cd/b9/6abe1cd8ac8e70f12f43eebe6427814f9d36142d331eae5cc5bba77585a2/mypy-1.3.0-cp311-cp311win amd64.whl (8.9 MB)
Collecting pyls-isort==0.2.2
Using cached
https://pypi.tunatsinghua.edu.cn/packages/be/61/775e74d8b5e34af59f8c607e7a1584d2a1774f1a1a4af8fc0a96ecc5e499/pyls-isort-0.2.2.tar.gz (2.7KB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'doneCollecting pylsp-mypy==0.6.6
Using cached
https://pypitunatsinghuaedu.cn/packages/6b/da/08322d708bfb4f92a2a468fef31b2c68202cdab795580a65a6969b6f904/pylsp mypy-0.6.6-py3-none-any.whl (10 kB)
Collecting python-lsp-black==1.2.1
Using cached
https://pypitunatsinghua.edu.cn/packages/0a/f4/dbadfbfbd1472569d8c8a8df7a89b8be0c15d3fa20fd635f0cc48467318e/python lsp black-1.2.1-py3-none-any.whl (6.2 kB)
Collecting python-lsp-ruff==1.4.0
Using cached
https://pypituna.tsinghua.edu.cn/packages/31/0c/a692c3fd6c084a1daafea0d922d97f532e1a61d168e482e022340adda35c/python lsp ruff-1.4.0-py3-none-any.whl (9.2 kB)
ERROR: Could not find a version that satisfies the requirementpython-lsp-serverlall]==1.7.3 (from versions: 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.11.2.2, 1.2.3, 1.2.4, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.5.0, 1.6.0, 1.7.0, 1.7.11.7.2)
ERROR: No matching distribution found for python-lsp-serverlall]==1.7.3
for example import
can have autocompletion on builtin modules such as time, os, etc. However, it does not work on 3rd party packages at all such as pandas, numpy, lxml, etc. The autocompletion on dot also does not work for those packages. Is the expected?
I did:
pip3 install python-lsp-server[all]
I also installed:
pyls-flake8 0.4.0
pyls-isort 0.2.2
pyls-mypy 0.1.8
pylsp-rope 0.1.8
python-lsp-black 1.0.1
How do you get doc hints when you hover over a basic method (for example .get, .dict, .copy etc)? I can't get it to work. With methods from imports / self written ones I get the desired popover.
With Pyright I get it correctly:
My LSP-pylsp.sublime-settings looks like this:
{
"settings":
{
"pylsp.plugins.jedi.environment": "./.venv/"
}
}
- as I want Pylsp to pick up virtual environment I've set up.
BTW - is there a way to set such things up in some sort of config file in the project, instead of "global" setting in Sublime config? I really like the way it is done in Pyright via pryrightconfig.json .
I've found setup.cfg, but it seems I can set pycodestyle there (for example ignores), but not venv.
Hello,
While the README doesn't mention MacOS support, I was able to get this working just fine by cloning this repo into my Sublime Packages directory.
Thanks for the nice work on this!
Hi, I use per-file-ignores, which have recently been added to python-lsp/python-lsp-server/pull/28. Does anything special have to happen with this plugin to support this feature?
To use pylsp
installed in WSL, we can directly set up a client in LSP
with command
set to ["bash.exe", "-c", "absolute_wsl_path_to_pylsp"]
.
However, with this helper package LSP-pylsp
, if we set command
to the above value, it does not work. I suppose that the command
in this package just overrides the corresponding key in LSP
. How can we use pylsp
in WSL with this package?
I'm using Sublime Text 4 with LSP-pylsp on macOS for writing Python code. I use conda environments and have black installed in the environment. However, when I run LSP: Format File in Sublime Text, it does not format the Python file using black. I tried the settings shown below in my .sublime-project file but it doesn't fix my issue.
{
"python_binary": "/opt/miniconda3/envs/myproj/bin/python",
"folders":
[
{
"path": "."
}
],
"settings": {
"LSP": {
"LSP-pylsp": {
"settings": {
"pylsp.plugins.jedi.environment": "/opt/miniconda3/envs/myproj"
}
}
}
}
}
Below are my settings in the LSP-pylsp.sublime-settings file.
{
"settings": {
"pylsp.configurationSources": [
"flake8"
],
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.flake8.enabled": true,
"pylsp.plugins.flake8.maxLineLength": 120,
"pylsp.plugins.pylsp_black.enabled": true,
}
}
I'd like to use bugbear and a few other flake8 plugins within ST4 (4126) on macOS 12.4 21F79 arm64.
LSP, LSP-pylsp, and flake8 seem to be working, and I can get flake8 diagnostics (e.g., line too long) but they don't include plugin diagnostics. Do I need to do something to enable them in my LSP-pylsp.sublime-settings
?
// Settings in here override those in "LSP-pylsp/LSP-pylsp.sublime-settings"
{
"settings":
{
"pylsp.plugins.flake8.enabled": true,
// "pylsp.plugins.flake8.maxLineLength": 88,
"pylsp.plugins.flake8.perFileIgnores":
[
"emit_biblatex.py:E203,E241,E701,E117,W503",
"emit_yaml_csl.py:E203,E241,E701,E117,W503",
"biblio_fields.py:E241"
],
"pylsp.configurationSources": ["flake8"],
// "pylsp.configurationSources": ["pycodestyle"],
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.mccabe.enabled": false,
"pylsp.plugins.pyflakes.enabled": false,
"pylsp.plugins.pyls_isort.enabled": true,
}
}
It doesn’t matter what formatter I use. I didn’t have this problem when I used pyls
before.
settings:
"pylsp": {
"selector": "source.python",
"settings": {
"plugins": {
"yapf.enabled": true,
"autopep8.enabled": false
}
}
}
yapf config:
[style]
based_on_style = pep8
column_limit = 248
yapf
is not working?
When trying to format a file, nothing happens to the current file. In the LSP log panel, this error appears:
LSP-pylsp: 2022-03-14 20:50:00,152 GMT Standard Time - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 27
LSP-pylsp: Traceback (most recent call last):
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\endpoint.py", line 116, in consume
LSP-pylsp: self._handle_request(message['id'], message['method'], message.get('params'))
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\endpoint.py", line 185, in _handle_request
LSP-pylsp: handler_result = handler(params)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_jsonrpc\dispatchers.py", line 25, in handler
LSP-pylsp: return method(**(params or {}))
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 366, in m_text_document__formatting
LSP-pylsp: return self.format_document(textDocument['uri'])
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 281, in format_document
LSP-pylsp: return self._hook('pylsp_format_document', doc_uri)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp\python_lsp.py", line 156, in _hook
LSP-pylsp: return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
LSP-pylsp: return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
LSP-pylsp: return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_manager.py", line 327, in traced_hookexec
LSP-pylsp: return outcome.get_result()
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_result.py", line 60, in get_result
LSP-pylsp: raise ex[1].with_traceback(ex[2])
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_result.py", line 33, in from_call
LSP-pylsp: result = func()
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_manager.py", line 324, in <lambda>
LSP-pylsp: lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
LSP-pylsp: return outcome.get_result()
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_result.py", line 60, in get_result
LSP-pylsp: raise ex[1].with_traceback(ex[2])
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
LSP-pylsp: res = hook_impl.function(*args)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_black\plugin.py", line 13, in pylsp_format_document
LSP-pylsp: return format_document(document)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_black\plugin.py", line 36, in format_document
LSP-pylsp: config = load_config(document.path)
LSP-pylsp: File "c:\users\james\appdata\local\sublime text\package storage\lsp-pylsp\lib\site-packages\pylsp_black\plugin.py", line 82, in load_config
LSP-pylsp: pyproject_filename = root / "pyproject.toml"
LSP-pylsp: TypeError: unsupported operand type(s) for /: 'tuple' and 'str'
In plugin.py
line 80, the value of root is (WindowsPath('D:/'), 'file system root')
. Looking at Black's documentation, this function is expected to output a tuple - https://black.readthedocs.io/en/stable/contributing/reference/reference_functions.html#black.find_project_root
I'm seeing this message in ST4 console that's somewhat mysterious:
Unable to start subprocess for LSP-pylsp
Traceback (most recent call last):
File "C:\Users\mchan811\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py", line 241, in start_async
plugin_class.install_or_update()
File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\_client_handler\abstract_plugin.py", line 109, in install_or_update
server.install_or_update()
File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_pip_resource.py", line 97, in install_or_update
self.run(self._python_binary, '-m', 'venv', self._package_name, cwd=self._storage_path)
File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_pip_resource.py", line 35, in run
raise Exception(error)
Exception: Error: [WinError 2] The system cannot find the file specified
I tried reinstalling both LSP-pylsp and the LSP package to no avail. Any suggestions?
Performance for showing the completion menu is VERY slow (takes over 3 seconds to appear for a 150-line Python script even for primitive types like str
). Confirmed that this happens on two different machines: gen 10 i7s with 16GB and 64GB of RAM respectively so hardware isn't the bottleneck.
Fedora 35
Sublime v 4126
Python v3.10.4
LSP v1.16.2
LSP-pylsp v2.3.3
{
"settings": {
"pylsp.plugins.pyflakes.enabled": false,
"pylsp.plugins.pylsp_mypy.enabled": false,
"pylsp.plugins.mccabe.enabled": false,
"pylsp.plugins.preload.enabled": false,
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.pycodestyle.ignore": [
"E221",
"E241",
"E501",
"W504",
],
}
}
{
"document_highlight_style": "fill",
}
Finally, thanks for your work. This thing does almost everything I need it to, just unbearably slowly...
I have installed LSP-pylsp on ST4 and generally everything is working well.
Only problem I have is that it isn't providing me with any autocompletions for numpy.
I have everything in a venv and am pretty sure I'm pointing to the right location with the following in a .sublime-project
file:
"settings": {
"LSP": {
"LSP-pylsp": {
"command": [
"/Path/To/venv/my_venv/bin/pylsp",
],
"settings": {
// Jedi config
"pylsp.plugins.jedi.environment": "/Path/To/venv/my_venv",
// Linter config:
"pylsp.plugins.pycodestyle.enabled": false,
"pylsp.plugins.flake8.enabled": true,
"pylsp.configurationSources": ["flake8"],
// formatter config
"pylsp.plugins.autopep8.enabled": false,
"pylsp.plugins.pylsp_black.enabled": true,
"pylsp.plugins.pylsp_black.cache_config": true,
"pylsp.plugins.pylsp_black.line_length": 88,
"pylsp.plugins.pylsp_black.preview": true,
},
},
},
},
Generally I am getting autocompletion.
If I start typing import it suggests modules in my venv:
It then suggests autocompletions for functions in that module:
However, this is not working for numpy.
It detects numpy in my venv when I come to import it (see image above), but does not provide any numpy autocompletion when using it:
If you can work out what's going wrong I'd be really grateful, and apologies if I've missed something somewhere - I've been battling with setting this up all afternoon. Thanks.
Eventhough mypy
disabled in LSP-pylsp
preference, but mypy
still reproduce cache file and check for errors
mypy
disabled if configured so in LSP-pylsp
preference
I have explicitly configured so that mypy
disabled:
// Settings in here override those in "LSP-pylsp/LSP-pylsp.sublime-settings"
{
"settings": {
"pylsp.env": {
"PYTHONPATH": "$sublime_py_files_dir:$packages",
// "MYPY_PATH": "$sublime_py_files_dir:$packages"
},
"pylsp.plugins.mypy-ls.enabled": false,
"pylsp.plugins.mypy-ls.live_mode": false,
},
}
but when I open any Python files, it still reproduce .mypy.cache
file and still show mypy errors
Hello,
I can't find a way to run LSP-pylsp after installing the package I get this error :
FileNotFoundError: [Errno 2] No such file or directory: '~/.cache/sublime-text-3/Package Storage/LSP-pylsp/bin/pip'
I have tried creating the folder and restart but it looks like something is removing it.
Can anyone help me to figure this out ?
P.S. : I have LSP-pyright running perfectly
EDIT : Adding the traceback :
Traceback (most recent call last):
File "~/.config/sublime-text-3/Installed Packages/LSP.sublime-package/plugin/core/windows.py", line 245, in start_async
plugin_class.install_or_update()
File "~/.config/sublime-text-3/Packages/lsp_utils/st3/lsp_utils/_client_handler/abstract_plugin.py", line 109, in install_or_update
server.install_or_update()
File "~/.config/sublime-text-3/Packages/lsp_utils/st3/lsp_utils/server_pip_resource.py", line 100, in install_or_update
self.run(self.pip_binary(), 'install', '-r', dest_requirements_txt_path, '--disable-pip-version-check')
File "~/.config/sublime-text-3/Packages/lsp_utils/st3/lsp_utils/server_pip_resource.py", line 33, in run
output, error = run_command_sync(list(args), cwd=cwd)
File "~/.config/sublime-text-3/Packages/lsp_utils/st3/lsp_utils/helpers.py", line 40, in run_command_sync
args, cwd=cwd, shell=shell, stderr=subprocess.STDOUT, env=env, startupinfo=startupinfo)
File "./python3.3/subprocess.py", line 576, in check_output
File "./python3.3/subprocess.py", line 819, in __init__
File "./python3.3/subprocess.py", line 1452, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: '~/.cache/sublime-text-3/Package Storage/LSP-pylsp/bin/pip'
As in title, I would like to be able to use pylsp
executable that I have globally installed in my system rather than rely on the one installed in a venv created by LSP-pylsp.
This would allow pylsp plugins to be able to see and use the additional dependencies like mypy plugins, type stubs, and regular python packages that are needed for static analysis.
Tracking here paradoxxxzero/pyls-isort#4
Hi, im starting to learn python and decided to try this for sublime text 4, but im having a crash server.
Here's what i did.
winget install -e --id SublimeHQ.SublimeText.4
winget install -e --id Python.Python.3.11
pip install python-lsp-server[all]
Restart pc and open sublime text 4.
inside sublime text 4, i install LSP
and LSP-pylsp
but when i open sublime and open .py file it crashes.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Scripts\pylsp.exe\__main__.py", line 4, in <module>
File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\__main__.py", line 15, in <module>
from .python_lsp import (PythonLSPServer, start_io_lang_server,
File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\python_lsp.py", line 9, in <module>
import ujson as json
ImportError: DLL load failed while importing ujson: The specified module could not be found.
[
"$server_path"
]
"C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Scripts\pylsp.exe"
source.python
(source.python)
{}
{
"pylsp": {
"configurationSources": [
"pycodestyle"
],
"plugins": {
"autopep8": {
"enabled": true
},
"flake8": {
"config": null,
"enabled": false,
"exclude": null,
"executable": "flake8",
"filename": null,
"hangClosing": null,
"ignore": null,
"maxComplexity": null,
"maxLineLength": null,
"perFileIgnores": null,
"select": null
},
"jedi": {
"auto_import_modules": [
"numpy"
],
"env_vars": null,
"environment": null,
"extra_paths": [
"$sublime_py_files_dir",
"$packages"
]
},
"jedi_completion": {
"cache_for": [
"pandas",
"numpy",
"tensorflow",
"matplotlib"
],
"eager": false,
"enabled": true,
"fuzzy": true,
"include_class_objects": false,
"include_function_objects": false,
"include_params": true,
"resolve_at_most": 25
},
"jedi_definition": {
"enabled": true,
"follow_builtin_definitions": true,
"follow_builtin_imports": true,
"follow_imports": true
},
"jedi_hover": {
"enabled": true
},
"jedi_references": {
"enabled": true
},
"jedi_signature_help": {
"enabled": true
},
"jedi_symbols": {
"all_scopes": true,
"enabled": true,
"include_import_symbols": true
},
"mccabe": {
"enabled": true,
"threshold": 15
},
"preload": {
"enabled": true,
"modules": null
},
"pycodestyle": {
"aggressive": null,
"enabled": true,
"exclude": null,
"filename": null,
"hangClosing": null,
"ignore": null,
"maxLineLength": null,
"select": null
},
"pydocstyle": {
"addIgnore": null,
"addSelect": null,
"convention": null,
"enabled": false,
"ignore": null,
"match": "(?!test_).*\\.py",
"matchDir": "[^\\.].*",
"select": null
},
"pyflakes": {
"enabled": false
},
"pylint": {
"args": null,
"enabled": false,
"executable": ""
},
"pyls_isort": {
"enabled": false
},
"pylsp_black": {
"cache_config": false,
"enabled": false,
"line_length": 88,
"preview": false
},
"pylsp_mypy": {
"config_sub_paths": [],
"dmypy": false,
"dmypy_status_file": ".dmypy.json",
"enabled": false,
"live_mode": true,
"overrides": [
true
],
"report_progress": false,
"strict": false
},
"rope_autoimport": {
"enabled": false,
"memory": false
},
"rope_completion": {
"eager": false,
"enabled": false
},
"yapf": {
"enabled": false
}
},
"rope": {
"extensionModules": null,
"ropeFolder": null
}
}
}
{
"MYPYPATH": "${sublime_py_files_dir}${pathsep}${packages}",
"PATH": "C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;",
"PYTHONPATH": "${sublime_py_files_dir}${pathsep}${packages}"
}
C:\Users\hoaxdream\Desktop\src\pythonproj\test.py
{
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
"lsp_active": null,
"syntax": "Packages/Python/Python.sublime-syntax"
}
source.python
[
"C:\\Users\\hoaxdream\\Desktop\\src\\pythonproj"
]
{}
This will make the installation so much easier
I'm trying to disable certain errors, like line too long (e501), but can't find any info howto do it. Any help greatly appreciated.
Hello, I'm getting this message from LSP-pylsp
pkg_resources.ContextualVersionConflict: (typed-ast 1.5.0 (/home/julian/.cache/sublime-text-3/Package Storage/LSP-pylsp/lib/python3.7/site-packages), Requirement.parse('typed-ast<1.5.0,>=1.4.0;python_version < "3.8"'),{'mypy'})
I tried upgrading mypy on my system (as local user and sudo) it didn't help.
I'm trying to downgrade typed-ast now
Hello,
Is there a method to use a proxy in order to download the required Python packages during installation? I'm behind a corporate firewall and can't download from external sources without a proxy bypass.
I'm using ST4(4101) on macOS 11.2.3.
My project settings:
{
"folders": [
{
"path": ".",
}
],
"settings": {
"LSP": {
"pyls": {
"enabled": true,
"env": {
"PYTHONPATH": "/Users/thepoy/venvs/spider/lib/python3.8/site-packages",
},
"command": [
"/Users/thepoy/Library/Python/3.8/bin/pyls"
],
},
},
},
}
pyls
can't work.
The log in console:
Traceback (most recent call last):
File "/Users/thepoy/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 137, in invoke
File "/Users/thepoy/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/core/sessions.py", line 1259, in on_transport_close
File "/Users/thepoy/Library/Application Support/Sublime Text/Installed Packages/LSP.sublime-package/plugin/core/windows.py", line 433, in on_post_exit_async
File "./python3.3/_weakrefset.py", line 60, in __iter__
RuntimeError: Set changed size during iteration
Hi,
as soon as I install this package I have an issue with the trailing symbols, see: https://forum.sublimetext.com/t/autocomplete-trailing-symbols/59677/6
EDIT: The issue still persists if I deactivate Jedi Support
Additional Info: The issue also occurs with LSP-pyright
Here is my pylsp configuration:
{
"pylsp.configurationSources": ["flake8"],
"pylsp.plugins.flake8.enabled": true,
"pylsp.plugins.pycodestyle.enabled": false,
}
And I try to restart sublime several times, however, it just doesn't work and linter is stiil pycodestyle.
But, what is strange is that the option "python-binary" can work when I rewrite it. So, I think the user configuration on linter written by user seems to be unable to cover the defualt.
I'm seeing this message in the console
Traceback (most recent call last):
File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 308, in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/__init__.py", line 90, in import_module
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 1692, in load_module
exec(compile(source, source_path, 'exec'), mod.__dict__)
File "/home/julian/.config/sublime-text-3/Installed Packages/LSP-pylsp.sublime-package/plugin.py", line 1, in <module>
ImportError: No module named 'LSP'
My machine is linux mint debian edition LMDE4
I don't know anything about how ST loads packages, but nothing else is creating an error
.config/sublime-text-3/Installed Packages/LSP-pylsp.sublime-package/plugin.py
is not a file
.config/sublime-text-3/Installed Packages/LSP-pylsp.sublime-package
is an archive with plugin.py in it.
Thanks
Pylsp is unable to find some modules like the csv and some other external modules.
I've set up this package a week or so ago and it created a cached directory with pyvenv.cfg
with version = 3.7.7
.
I have later updated python to 3.8.3 through brew and then this package started crashing on this line:
https://github.com/sublimelsp/LSP-pyls/blob/2909522a310dbb665acead21a988eb68469b4074/plugin.py#L74
with a stderr:
Traceback (most recent call last):
File "/Users/me/Library/Application Support/Sublime Text/Cache/LSP-pyls/bin/pip", line 8, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip'
Deleting the Cache/LSP-pyls
directory helped as that recreated the virtual environment using latest Python.
I would probably suggest catching errors in needs_update_or_installation
and return True
in such a case so that the cache is recreated and handles such issues automatically.
Hi! I'm under Linux Mint 21 Vanessa (based on Ubuntu 22.04 jammy) where the python3
command points to the system python 3.10 version. In order to preserve that version for the system and use python 3.11 for development, I've installed separately python 3.11 from source. Now I have python3
and python3.11
in my PATH. Can I point LSP-pylsp to use the python3.11
command? By default it takes python3
... I cannot figure out how to do it. Thank you!
Is there any way to use this with conda on windows 10? I cannot figure out how to properly configure the python path so that the server can start.
Currently I get an error message:
Failed to start LSP-pylsp - disabling for this window for the duration of
the current session.
Re-enable by running "LSP: Enable Language Sever In Project" from the command palette.--- Error: ---
'python' is not recognized as an internal or external command,
operable program of batch file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.