Extension version (available under the Extensions sidebar): 2021.4.658580515-dev
OS and version: XXX
Python version (& distribution if applicable, e.g. Anaconda): 3.8.2
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
Relevant/affected Python packages and their versions: N/A
Relevant/affected Python-related VS Code extensions and their versions: N/A
Value of the python.languageServer setting: JediLSP
[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]
Expected behaviour
No errors.
Actual behaviour
Errors in Output panel (see logs below).
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
Try a completion
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
```
Failed to handle request 7 textDocument/codeAction Object(textDocument=Object(uri='file:///home/brettcannon/scratch/Some%20Python%20test%20space/whatever.py'), range=Object(start=Object(line=22, character=3), end=Object(line=22, character=3)), context=Object(diagnostics=[]))
Traceback (most recent call last):
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 324, in _handle_request
self._execute_request(msg_id, handler, params)
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 249, in _execute_request
self._send_response(msg_id, handler(params))
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi_language_server/server.py", line 448, in code_action
extract_function_refactoring = jedi_script.extract_function(
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 62, in wrapper
return func(self, *args, **kwargs)
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 781, in extract_function
return self._extract_function(line, column, **kwargs) # Python 2...
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/helpers.py", line 487, in wrapper
return func(self, line, column, *args, **kwargs)
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 793, in _extract_function
return extract_function(
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 244, in extract_function
first, second = _split_prefix_at(after_leaf, until_pos[0])
File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 148, in _split_prefix_at
second_line_count = leaf.start_pos[0] - until_line
AttributeError: 'NoneType' object has no attribute 'start_pos'
[Error - 12:07:12 PM] Request textDocument/codeAction failed.
Message: AttributeError: 'NoneType' object has no attribute 'start_pos'
Code: -32602
{'traceback': [' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 324, in _handle_request\n self._execute_request(msg_id, handler, params)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 249, in _execute_request\n self._send_response(msg_id, handler(params))\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi_language_server/server.py", line 448, in code_action\n extract_function_refactoring = jedi_script.extract_function(\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 62, in wrapper\n return func(self, *args, **kwargs)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 781, in extract_function\n return self._extract_function(line, column, **kwargs) # Python 2...\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/helpers.py", line 487, in wrapper\n return func(self, line, column, *args, **kwargs)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 793, in _extract_function\n return extract_function(\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 244, in extract_function\n first, second = _split_prefix_at(after_leaf, until_pos[0])\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 148, in _split_prefix_at\n second_line_count = leaf.start_pos[0] - until_line\n']}
```
Environment data
python.languageServer
setting: JediLSP[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (
python.languageServer: 'Microsoft'
), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]Expected behaviour
No errors.
Actual behaviour
Errors in Output panel (see logs below).
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)``` Failed to handle request 7 textDocument/codeAction Object(textDocument=Object(uri='file:///home/brettcannon/scratch/Some%20Python%20test%20space/whatever.py'), range=Object(start=Object(line=22, character=3), end=Object(line=22, character=3)), context=Object(diagnostics=[])) Traceback (most recent call last): File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 324, in _handle_request self._execute_request(msg_id, handler, params) File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 249, in _execute_request self._send_response(msg_id, handler(params)) File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi_language_server/server.py", line 448, in code_action extract_function_refactoring = jedi_script.extract_function( File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 62, in wrapper return func(self, *args, **kwargs) File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 781, in extract_function return self._extract_function(line, column, **kwargs) # Python 2... File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/helpers.py", line 487, in wrapper return func(self, line, column, *args, **kwargs) File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 793, in _extract_function return extract_function( File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 244, in extract_function first, second = _split_prefix_at(after_leaf, until_pos[0]) File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 148, in _split_prefix_at second_line_count = leaf.start_pos[0] - until_line AttributeError: 'NoneType' object has no attribute 'start_pos' [Error - 12:07:12 PM] Request textDocument/codeAction failed. Message: AttributeError: 'NoneType' object has no attribute 'start_pos' Code: -32602 {'traceback': [' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 324, in _handle_request\n self._execute_request(msg_id, handler, params)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/pygls/protocol.py", line 249, in _execute_request\n self._send_response(msg_id, handler(params))\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi_language_server/server.py", line 448, in code_action\n extract_function_refactoring = jedi_script.extract_function(\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 62, in wrapper\n return func(self, *args, **kwargs)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 781, in extract_function\n return self._extract_function(line, column, **kwargs) # Python 2...\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/helpers.py", line 487, in wrapper\n return func(self, line, column, *args, **kwargs)\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/__init__.py", line 793, in _extract_function\n return extract_function(\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 244, in extract_function\n first, second = _split_prefix_at(after_leaf, until_pos[0])\n', ' File "/home/brettcannon/.vscode-server-insiders/extensions/ms-python.python-2021.4.658580515-dev/pythonFiles/lib/python/jedi/api/refactoring/extract.py", line 148, in _split_prefix_at\n second_line_count = leaf.start_pos[0] - until_line\n']} ```