Closed jajcayn closed 10 months ago
@jajcayn Can you share what you have in you workspace? (python -m pip list
) This issue can occur if there is a different version of pygls
in the environment.
sure:)
Package Version
------------------------- ---------
aiofiles 22.1.0
aiosqlite 0.19.0
anyio 3.6.2
appnope 0.1.3
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
arrow 1.2.3
asttokens 2.2.1
async-lru 2.0.2
attrs 23.1.0
Babel 2.12.1
backcall 0.2.0
beautifulsoup4 4.12.2
black 23.10.1
bleach 6.0.0
certifi 2023.5.7
cffi 1.15.1
cftime 1.6.2
chaospy 4.3.12
charset-normalizer 3.1.0
click 8.1.3
cloudpickle 2.2.1
colorama 0.4.6
comm 0.1.3
contourpy 1.0.7
cycler 0.11.0
debugpy 1.6.7
decorator 5.1.1
defusedxml 0.7.1
diffrax 0.4.0
dill 0.3.7
dispy 4.15.2
efel 4.2.5
elephant 0.12.0
equinox 0.10.4
exdir 0.4.2
executing 1.2.0
fastjsonschema 2.16.3
fastmat 0.2.2
flake8 6.1.0
fonttools 4.39.4
fqdn 1.5.1
gitdb 4.0.10
GitPython 3.1.31
h5netcdf 1.2.0
h5py 3.10.0
idna 3.4
importlib-metadata 6.6.0
importlib-resources 5.12.0
ipykernel 6.23.0
ipython 8.13.2
ipython-genutils 0.2.0
ipywidgets 8.1.1
isoduration 20.11.0
isort 5.12.0
jax 0.4.8
jaxlib 0.4.7
jaxtyping 0.2.23
jedi 0.18.2
Jinja2 3.1.2
joblib 1.2.0
json5 0.9.11
jsonpointer 2.3
jsonschema 4.17.3
julia 0.6.1
jupyter_client 8.2.0
jupyter_core 5.3.0
jupyter-events 0.6.3
jupyter-lsp 2.1.0
jupyter_server 2.5.0
jupyter_server_fileid 0.9.0
jupyter-server-mathjax 0.2.6
jupyter_server_terminals 0.4.4
jupyter_server_ydoc 0.8.0
jupyter-ydoc 0.2.4
jupyterlab 3.6.6
jupyterlab_code_formatter 2.2.1
jupyterlab_git 0.44.0
jupyterlab-pygments 0.2.2
jupyterlab_server 2.22.1
jupyterlab-spellchecker 0.8.3
jupyterlab-sublime 0.4.1
jupyterlab-widgets 3.0.9
kiwisolver 1.4.4
llvmlite 0.40.0
MarkupSafe 2.1.2
matlabengine 23.2
matplotlib 3.8.1
matplotlib-inline 0.1.6
mccabe 0.7.0
mistune 2.0.5
ml-dtypes 0.1.0
mne 1.5.1
multiprocess 0.70.15
mypy-extensions 1.0.0
nbclassic 1.0.0
nbclient 0.7.4
nbconvert 7.4.0
nbdime 3.2.1
nbformat 5.8.0
neo 0.12.0
nest-asyncio 1.5.6
netCDF4 1.6.5
notebook 6.5.4
notebook_shim 0.2.3
numba 0.57.0
numpoly 1.2.7
numpy 1.24.4
opt-einsum 3.3.0
packaging 23.1
pandas 2.1.2
pandocfilters 1.5.0
parso 0.8.3
pathos 0.3.1
pathspec 0.11.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.5.0
pip 23.3.1
platformdirs 3.5.0
pooch 1.8.0
pox 0.3.3
ppft 1.7.6.7
prometheus-client 0.16.0
prompt-toolkit 3.0.38
psutil 5.9.5
ptyprocess 0.7.0
pure-eval 0.2.2
pycodestyle 2.11.0
pycos 4.12.2
pycparser 2.21
pyflakes 3.1.0
Pygments 2.15.1
pygpc 0.3.3
pyparsing 3.0.9
PyQt5 5.15.10
PyQt5-Qt5 5.15.11
PyQt5-sip 12.13.0
pyrsistent 0.19.3
python-dateutil 2.8.2
python-json-logger 2.0.7
pytz 2023.3
PyYAML 6.0
pyzmq 25.0.2
quantities 0.14.1
requests 2.30.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
ruamel.yaml 0.17.26
ruamel.yaml.clib 0.2.7
SALib 1.4.5
scikit-learn 1.2.2
scipy 1.11.3
seaborn 0.13.0
Send2Trash 1.8.2
setuptools 67.6.1
shap 0.43.0
six 1.16.0
slicer 0.0.7
smmap 5.0.0
sniffio 1.3.0
soupsieve 2.4.1
stack-data 0.6.2
terminado 0.17.1
threadpoolctl 3.1.0
tinycss2 1.2.1
tomli 2.0.1
tornado 6.3.1
tqdm 4.65.0
traitlets 5.9.0
typeguard 2.13.3
typer 0.9.0
typing_extensions 4.5.0
tzdata 2023.3
uncertainpy 1.2.0
uri-template 1.2.0
urllib3 2.0.2
wcwidth 0.2.6
webcolors 1.13
webencodings 0.5.1
websocket-client 1.5.1
wheel 0.40.0
widgetsnbextension 4.0.9
xarray 2023.10.1
xvfbwrapper 0.2.9
y-py 0.5.9
ypy-websocket 0.8.2
zipp 3.15.0
Also seeing this, found that it only happens for me when importStrategy
is fromEnvironment
to pin, tried with local isort versions 5.10.1 and 5.12.0
@jajcayn Can you share what you have in you workspace? (
python -m pip list
) This issue can occur if there is a different version ofpygls
in the environment.
No pygls in my poetry.lock
2023-11-03 19:51:34.723 [info] Traceback (most recent call last):
File "/Users/_/.vscode/extensions/ms-python.isort-2023.10.1/bundled/tool/lsp_server.py", line 197, in <module>
def code_action_organize_imports(params: lsp.CodeActionParams):
File "/Users/_/.vscode/extensions/ms-python.isort-2023.10.1/bundled/libs/pygls/feature_manager.py", line 174, in decorator
raise TypeError(
TypeError: Options of method "textDocument/codeAction" should be instance of type <class 'lsprotocol.types.CodeActionOptions'>
Version: 1.84.0
Commit: d037ac076cee195194f93ce6fe2bdfe2969cc82d
Date: 2023-11-01T11:29:51.160Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0
I just pushed a pre-release version that should address this. Can you switch to pre-release and see if it helps? The issue occurs due to a mismatch with Typeguard.
I just pushed a pre-release version that should address this. Can you switch to pre-release and see if it helps? The issue occurs due to a mismatch with Typeguard.
Thanks for the quick look, switched to pre-release v2023.11.13071012
, still crashing the same way:
2023-11-04 17:46:12.618 [info] [Error - 5:46:12 PM] Server initialization failed.
2023-11-04 17:46:12.618 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-11-04 17:46:12.618 [info] [Info - 5:46:12 PM] Connection to server got closed. Server will restart.
2023-11-04 17:46:12.618 [info] true
2023-11-04 17:46:12.618 [info] [Error - 5:46:12 PM] isort client: couldn't create connection to server.
2023-11-04 17:46:12.618 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-11-04 17:46:12.618 [info] [Error - 5:46:12 PM] Restarting server failed
2023-11-04 17:46:12.618 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-11-04 17:46:12.887 [info] Traceback (most recent call last):
File "/Users/_/.vscode/extensions/ms-python.isort-2023.11.13071012/bundled/tool/lsp_server.py", line 197, in <module>
def code_action_organize_imports(params: lsp.CodeActionParams):
File "/Users/_/.vscode/extensions/ms-python.isort-2023.11.13071012/bundled/libs/pygls/feature_manager.py", line 193, in decorator
raise TypeError(
TypeError: Options of method "textDocument/codeAction" should be instance of type <class 'lsprotocol.types.CodeActionOptions'>
2023-11-04 17:46:12.928 [info] [Error - 5:46:12 PM] Server initialization failed.
2023-11-04 17:46:12.928 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-11-04 17:46:12.928 [info] [Error - 5:46:12 PM] The isort server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2023-11-04 17:46:12.928 [info] [Error - 5:46:12 PM] isort client: couldn't create connection to server.
2023-11-04 17:46:12.928 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-11-04 17:46:12.928 [info] [Error - 5:46:12 PM] Restarting server failed
2023-11-04 17:46:12.928 [info] Message: Pending response rejected since connection got disposed
Code: -32097
In a vaguely-related vein, I had a problem with isort crashing due to a bad import from typing_extensions (failed to import Buffer) when using fromEnvironment strategy only (bundled works fine). Running isort locally also works just fine.
My local environment (a venv) is Python 3.11.2, has isort 5.12.0 installed and no pygls module installed, but the failure was caused because typeguard (also not installed locally) was trying to import Buffer from typing_extensions and my local version was only 4.5.0 instead of the 4.8.0 version required by typeguard (as Buffer wasn't added until 4.6.0).
I've upgraded typing_extensions and it all works fine now, but perhaps this is useful information about another module that must be installed with the correct version locally?
This should work better if you set the importStrategy to useBundled
. For this extension to work properly with fromEnvironment
then that environment has to meet some minimums. One of them is typing_extensions
. the version we ship inbox is typing_extension==4.8.0
Here are two possible solutions:
[Option 1] : Use importStrategy useBundled
you don't have to worry about what version of packages you have.
[Option 2] : Use importStrategy fromEnvironment
then you have to meet the minimum requirements of the extension. Requirements can be found here: https://github.com/microsoft/vscode-isort/blob/main/requirements.txt
I am getting isort crashes, but, weirdly enough, not in all workspaces. I am getting
I am running VSCode:
I am using user settings for isort, not workspace, hence the settings should be the same for all workspaces.
Thanks for looking into it.