forked from tomv564/pyls-mypy
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
When mypy returns a "missing library stubs" error, like this:
test.py:3: error: Skipping analyzing "pylsp": module is installed, but missing library stubs or py.typed marker [import-untyped]
test.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
pylsp-mypy parses the "code" for the 2nd line as "None" (happens here).
When I try to use a code action on that line, helix doesn't pass the "code" back, and I get the following error:
"Traceback (most recent call last):\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pylsp/config/config.py\", line 39, in _hookexec\n"
" return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n"
" ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_manager.py\", line 480, in traced_hookexec\n"
" return outcome.get_result()\n"
" ~~~~~~~~~~~~~~~~~~^^\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_result.py\", line 100, in get_result\n"
" raise exc.with_traceback(exc.__traceback__)\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_result.py\", line 62, in from_call\n"
" result = func()\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_manager.py\", line 477, in <lambda>\n"
" lambda: oldcall(hook_name, hook_impls, caller_kwargs, firstresult)\n"
" ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_callers.py\", line 139, in _multicall\n"
" raise exception.with_traceback(exception.__traceback__)\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pluggy/_callers.py\", line 103, in _multicall\n"
" res = hook_impl.function(*args)\n"
" File \"/home/maddie/pg/t/venv/lib/python3.13/site-packages/pylsp_mypy/plugin.py\", line 576, in pylsp_code_actions\n"
" code = diagnostic[\"code\"]\n"
" ~~~~~~~~~~^^^^^^^^\n"
"KeyError: 'code'\n"
I believe this is a bug in pylsp-mypy (not helix) - the specification says diagnostic["code"] should be a string or integer.
The fix should be relatively straightforward - use an empty string when there's no code (in the lint action) or skip adding a code action if a diagnostic has no code (as it's likely an info message?) - I'd probably lean towards the latter.
Metadata
Metadata
Assignees
Labels
No labels