Closed smetj closed 9 months ago
Run LSP: Troubleshoot server on the the file in question and post the results. Feel free to filter out sensitive data.
Ok, do you mean something like this:
$ /home/user123/.cache/sublime-text/Package\ Storage/lsp_utils/node-runtime/18.18.1/node/bin/node /home/user123/.cache/sublime-text/Package\ Storage/LSP-pyright/18.18.1/language-server/node_modules/pyright/langserver.index.js --stdio < hello_world.py
Content-Length: 119
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Pyright language server 1.1.340 starting"}}Content-Length: 220
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Server root directory: file:///home/user123/.cache/sublime-text/Package%20Storage/LSP-pyright/18.18.1/language-server/node_modules/pyright/dist"}}
After which the server exits with 1
LSP: Troubleshoot server
is a command available in the command palette.
Got it:
## Server Configuration
- command
```json
[
"${node_bin}",
"${server_path}",
"--stdio"
]
"/home/user123/.cache/sublime-text/Package Storage/lsp_utils/node-runtime/18.18.1/node/bin/node" "/home/user123/.cache/sublime-text/Package Storage/LSP-pyright/18.18.1/language-server/node_modules/pyright/langserver.index.js" --stdio
source.python
(source.python - source.python.lsp)
{}
{
"pyright": {
"dev_environment": "",
"disableLanguageServices": false,
"disableOrganizeImports": false
},
"python": {
"analysis": {
"autoImportCompletions": true,
"autoSearchPaths": true,
"diagnosticMode": "openFilesOnly",
"diagnosticSeverityOverrides": {
"reportDuplicateImport": "warning",
"reportImplicitStringConcatenation": "warning",
"reportMissingParameterType": "none",
"reportUnboundVariable": "warning",
"reportUninitializedInstanceVariable": "none",
"reportUnusedClass": "information",
"reportUnusedFunction": "information",
"reportUnusedImport": "information",
"reportUnusedVariable": "information"
},
"extraPaths": [],
"logLevel": "Information",
"stubPath": "./typings",
"typeCheckingMode": "basic",
"typeshedPaths": [],
"useLibraryCodeForTypes": true
},
"pythonPath": "/home/user123/data/python/virtualenv/default/bin/python",
"venvPath": ""
}
}
{
"PATH": "/home/user123/.cache/sublime-text/Package Storage/lsp_utils/node-runtime/18.18.1/node/bin:/home/user123/.cache/sublime-text/Package Storage/lsp_utils/node-runtime/18.18.1/node/bin:"
}
/home/user123/data/hello_world/hello_world.py
{
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
"lsp_active": true,
"syntax": "Packages/Python/Python.sublime-syntax"
}
source.python
[]
{
"log_debug": true
}
That looks good.
What do you expect and what is happening exactly? Is this hellow_world file something you can share?
Also you can post logs from the "LSP Log Panel"
It looks like Pyright v1.1.340 has various issues: https://github.com/microsoft/pyright/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aopen I encounter none but rolling back to v1.1.339 can be an option too.
Lets see first what is the issue here.
the hello_world.py is just a silly script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# hello_world.py
#
import sys
def incr_one(number: int) -> int:
return number + 1
def main():
print(incr_one(10))
incr_one("10")
if __name__ == "__main__":
main()
What I would expect
incr_on...
auto-complete starts to pop up including the signature of the function ...log console looks like it's picking up on me editing
:: [16:21:44.784] -> LSP-pyright textDocument/didChange: {'contentChanges': [{'rangeLength': 0, 'range': {'start': {'line': 15, 'character': 16}, 'end': {'line': 15, 'character': 16}}, 'text': '"'}], 'textDocument': {'version': 255, 'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:44.785] --> LSP-pyright textDocument/completion (361): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 15, 'character': 17}}
:: [16:21:45.041] --> LSP-pyright textDocument/documentHighlight (362): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 15, 'character': 17}}
:: [16:21:46.085] --> LSP-pyright textDocument/documentHighlight (363): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 15, 'character': 16}}
:: [16:21:46.088] --> LSP-pyright textDocument/codeAction (364): {'context': {'triggerKind': 2, 'diagnostics': []}, 'range': {'start': {'line': 15, 'character': 16}, 'end': {'line': 15, 'character': 16}}, 'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:46.937] -> LSP-pyright textDocument/didSave: {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:48.452] --> LSP-pyright textDocument/documentHighlight (365): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 18, 'character': 9}}
:: [16:21:48.455] --> LSP-pyright textDocument/codeAction (366): {'context': {'triggerKind': 2, 'diagnostics': []}, 'range': {'start': {'line': 18, 'character': 9}, 'end': {'line': 18, 'character': 9}}, 'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:49.422] --> LSP-pyright textDocument/documentHighlight (367): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 14, 'character': 16}}
:: [16:21:49.426] --> LSP-pyright textDocument/codeAction (368): {'context': {'triggerKind': 2, 'diagnostics': []}, 'range': {'start': {'line': 14, 'character': 16}, 'end': {'line': 14, 'character': 16}}, 'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:50.046] --> LSP-pyright textDocument/documentHighlight (369): {'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}, 'position': {'line': 16, 'character': 0}}
:: [16:21:50.049] --> LSP-pyright textDocument/codeAction (370): {'context': {'triggerKind': 2, 'diagnostics': []}, 'range': {'start': {'line': 16, 'character': 0}, 'end': {'line': 16, 'character': 0}}, 'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
:: [16:21:56.029] --> LSP-pyright textDocument/codeAction (371): {'context': {'triggerKind': 1, 'only': ['refactor', 'source'], 'diagnostics': []}, 'range': {'start': {'line': 16, 'character': 0}, 'end': {'line': 16, 'character': 0}}, 'textDocument': {'uri': 'file:///home/user123/data/hello_world.py'}}
Looks like server is not responding. Maybe rollback would help although that doesn't look like the issues reported in pyright repo.
Actually I can reproduce this in 1.2.62 but not in 1.2.61 so rollback might be a good idea.
I've just tagged a new tag with Pyright 1.1.339.
It looks like Pyright 1.1.340 doesn't response (internally infinite loop?) if the file is open in "single file mode". If it's opened within folder (i.e., ST project), it's working.
Thanks guys! Latest version works as expected :bow: :+1:
Hi,
I am running:
Autocompletion has always worked but stopped working for unknown reasons.
The language server is able to start correctly when opening a python file:
Sublime console shows:
All LSP configuration remained default. There is no autcompletion/suggestions whatsoever. If I delete LSP then I get back sublimes text autocomplete
What can you recommend as next step to troubleshoot?