Hi all, trying to use python-language-server LSP implementation for something. I am programatically sending JSONRPC messages from Python to pyls using the options pyls --tcp --host localhost --port 8080, and here are the messages am I sending: {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"processId": None, "rootUri": "file:///Users/username/Folder", "capabilities": {"workspace": {"applyEdit": false, "workspaceEdit": {"documentChanges": false}}}}}
It responds with {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"codeActionProvider":true,"codeLensProvider":{"resolveProvider":false},"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"documentFormattingProvider":true,"documentHighlightProvider":true,"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"definitionProvider":true,"executeCommandProvider":{"commands":[]},"hoverProvider":true,"referencesProvider":true,"renameProvider":true,"foldingRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",","="]},"textDocumentSync":{"change":2,"save":{"includeText":true},"openClose":true},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}},"experimental":{}}}}
Then I try to get document symbols with this: {"jsonrpc": "2.0", "method": "textDocument/documentSymbol", "params": {"textDocument": {"uri": "file:///Users/username/Folder/main.py"}}, "id": 2}
This always gives back an error with this traceback: 2023-09-28 23:19:26,315 UTC - ERROR - pyls_jsonrpc.endpoint - Failed to handle request 3Traceback (most recent call last): File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls_jsonrpc/endpoint.py", line 113, in consume self._handle_request(message['id'], message['method'], message.get('params')) File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls_jsonrpc/endpoint.py", line 182, in _handle_request handler_result = handler(params) File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls_jsonrpc/dispatchers.py", line 23, in handler return method(**(params or {})) File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls/python_ls.py", line 322, in m_text_document__completion return self.completions(textDocument['uri'], position) File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls/python_ls.py", line 240, in completions completions = self._hook('pyls_completions', doc_uri, position=position) File "/Users/username/.pyenv/versions/3.10.13/envs/assembly/lib/python3.10/site-packages/pyls/python_ls.py", line 154, in _hook doc = workspace.get_document(doc_uri) if doc_uri else NoneAttributeError: 'NoneType' object has no attribute 'get_document'
Ideas why this is happening? |