-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright stop in container #82
Comments
Hi, thanks for the report! @meicale which version of distant.nvim and distant are you using? For the plugin, are you using the main branch? Or the v0.2 branch? Likewise, what version of the distant server are you using? You can get the version via |
Thank you so much for the your reply. I think it is a very cool feature supporting dev-container with less efforts. |
Ah, I missed your reply here. The assignment of '/' as root happens here: distant.nvim/lua/distant/cli/client/lsp.lua Line 108 in 9dd21f8
And gets reset here:
I think this is no longer necessary (was a workaround for an old neovim version), and may also be causing problems for #91. I'll look into removing it to see if that fixes your issue. From the screenshot and logs you've provided, I'm not seeing an error, but if the language server keeps crashing, there's definitely something wrong! |
As for neovim 0.9, I commented on neovim/neovim#21635 about integrating distant directly into neovim to support remote work beyond the TUI. This would let you not need a distant server and just have neovim support remote operations directly. Haven't heard back from justinmk, though. |
These lines indicate the problem of using "/" as the directory of the project. |
Closing out as an outdated issue. You can try the v0.3 branch to see if it resolves any issues, and open a new issue for v0.3 if the problem persists. Since v0.3 no longer does the hacks with the root directory as the updated neovim version doesn't fail if the directory is missing, this may have been solved. |
It is a really cool plugin and just what I wanted. I use dap with debugpy to debug python in remote and container, too. And this plugin just make things evern better.
But, I test this in a local docker container which was imported in WSL2 of Windows 11. The remote is another docker container have source code mounted by -v. The pyright lsp server seams started at first and then quit. I confused that why the log seems indetify the root is "/workspace" but the lspinfo says it is "/". Thanks!
BTW, neovim 0.9 will support remote plugin host , will that be based on this plugin?
SO, here is the details, Thanks!
The config i use is:
local status_ok, distant = pcall(require, "distant")
if not status_ok then
print("distant is NOT ok!")
return
end
local status_ok_2, actions = pcall(require, "distant.nav.actions")
if not status_ok_2 then
print("distant.nav.actions is NOT ok!")
return
end
distant.setup {
-- Any settings defined here are applied to all hosts
['*'] = {
distant = {
args = {'--shutdown', 'lonely=60'},
},
file = {
mappings = {
['-'] = actions.up,
},
},
dir = {
mappings = {
[''] = actions.edit,
['-'] = actions.up,
['K'] = actions.mkdir,
['N'] = actions.newfile,
['R'] = actions.rename,
['D'] = actions.remove,
}
},
},
-- Any settings defined here are applied only to example.com
['ssh://[email protected]:2222'] = {
distant = {
bin = '/bin/distant',
},
lsp = {
['python'] = {
cmd = { "pyright-langserver", "--stdio" },
filetypes = { 'python' },
root_dir = '/workspace',
on_attach = require("user.lsp.handlers").on_attach,
},
},
},
}
print("distant.nvim setted up!")
The error:
The lsp.log in local :
[START][2023-03-07 23:31:13] LSP logging initiated
[INFO][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:661 "Starting RPC client" { args = { "client", "lsp", "--windows-pipe", "nvim-2253", "--connection", "1500577842", "--unix-socket", "/home/bill/.cache/nvim/distant.nvim/nvim-7134.sock", "--", "pyright-langserver --stdio" }, cmd = "distant", extra = {}}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dataSupport = true, dynamicRegistration = false, isPreferredSupport = true, resolveSupport = { properties = { "edit" } } }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.8.3" }, processId = 14235, rootPath = "/workspace", rootUri = "file:///workspace", trace = "off", workspaceFolders = { { name = "/workspace", uri = "file:///workspace" } } }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "Pyright language server 1.1.296 starting", type = 3 }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "Server root directory: /root/.cache/pyright-python/1.1.296/node_modules/pyright/dist/", type = 3 }}
[INFO][2023-03-07 23:31:13] ...lsp/handlers.lua:489 "Pyright language server 1.1.296 starting"
[INFO][2023-03-07 23:31:13] ...lsp/handlers.lua:489 "Server root directory: /root/.cache/pyright-python/1.1.296/node_modules/pyright/dist/"
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = 'Starting service instance "/workspace"', type = 3 }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { id = 1, jsonrpc = "2.0", result = { capabilities = { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "source.organizeImports" }, workDoneProgress = true }, completionProvider = { completionItem = { labelDetailsSupport = true }, resolveProvider = true, triggerCharacters = { ".", "[" }, workDoneProgress = true }, declarationProvider = { workDoneProgress = true }, definitionProvider = { workDoneProgress = true }, documentHighlightProvider = { workDoneProgress = true }, documentSymbolProvider = { workDoneProgress = true }, executeCommandProvider = { commands = {}, workDoneProgress = true }, hoverProvider = { workDoneProgress = true }, referencesProvider = { workDoneProgress = true }, renameProvider = { prepareProvider = true, workDoneProgress = true }, signatureHelpProvider = { triggerCharacters = { "(", ",", ")" }, workDoneProgress = true }, textDocumentSync = 2, typeDefinitionProvider = { workDoneProgress = true }, workspaceSymbolProvider = { workDoneProgress = true } } }}
[INFO][2023-03-07 23:31:13] ...lsp/handlers.lua:489 'Starting service instance "/workspace"'
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { jsonrpc = "2.0", method = "initialized", params = vim.empty_dict()}
[INFO][2023-03-07 23:31:13] .../lua/vim/lsp.lua:1336 "LSP[1]" "server_capabilities" { server_capabilities = { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "source.organizeImports" }, workDoneProgress = true }, completionProvider = { completionItem = { labelDetailsSupport = true }, resolveProvider = true, triggerCharacters = { ".", "[" }, workDoneProgress = true }, declarationProvider = { workDoneProgress = true }, definitionProvider = { workDoneProgress = true }, documentHighlightProvider = { workDoneProgress = true }, documentSymbolProvider = { workDoneProgress = true }, executeCommandProvider = { commands = {}, workDoneProgress = true }, hoverProvider = { workDoneProgress = true }, referencesProvider = { workDoneProgress = true }, renameProvider = { prepareProvider = true, workDoneProgress = true }, signatureHelpProvider = { triggerCharacters = { "(", ",", ")" }, workDoneProgress = true }, textDocumentSync = { change = 2, openClose = true, save = { includeText = false }, willSave = false, willSaveWaitUntil = false }, typeDefinitionProvider = { workDoneProgress = true }, workspaceSymbolProvider = { workDoneProgress = true } }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "python", text = '#cjust for test the fibonacci\nimport numpy as np\ndef fib(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fib(n - 1) + fib(n - 2)\n\n\ndef test_fib_false():\n a = 3\n b = 3\n d = a / 0\n assert fib(0) == 1\n assert fib(3) == b\n assert fib(1) == a\n\nif name == "main":\n test_fib_false()\n', uri = "distant:///workspace/just_test.py", version = 0 } }}
[DEBUG][2023-03-07 23:31:13] .../lua/vim/lsp.lua:1381 "LSP[1]" "client.request" 1 "textDocument/documentHighlight" { position = { character = 0, line = 0 }, textDocument = { uri = "distant:///workspace/just_test.py" }} <function 1> 4
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 2, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 0, line = 0 }, textDocument = { uri = "distant:///workspace/just_test.py" } }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { id = 0, jsonrpc = "2.0", method = "client/registerCapability", params = { registrations = { { id = "60ae8e6b-c7a7-481e-95a4-bc66ca87a552", method = "workspace/didChangeWorkspaceFolders", registerOptions = vim.empty_dict() } } }}
[WARN][2023-03-07 23:31:13] ...lsp/handlers.lua:113 "The language server 1 triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = vim.NIL, status = true}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 0, jsonrpc = "2.0", result = vim.NIL}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = 'Starting service instance ""', type = 3 }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { id = 1, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "", section = "python" } } }}
[INFO][2023-03-07 23:31:13] ...lsp/handlers.lua:489 'Starting service instance ""'
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 1, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { id = 2, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "", section = "python.analysis" } } }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 2, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:388 "rpc.receive" { id = 3, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "", section = "pyright" } } }}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:403 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2023-03-07 23:31:13] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 3, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2023-03-07 23:31:14] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "No pyproject.toml file found.", type = 3 }}
[DEBUG][2023-03-07 23:31:14] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "stubPath typings is not a valid directory.", type = 2 }}
[DEBUG][2023-03-07 23:31:14] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "Assuming Python platform Linux", type = 3 }}
[DEBUG][2023-03-07 23:31:14] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "Searching for source files", type = 3 }}
[DEBUG][2023-03-07 23:31:14] .../vim/lsp/rpc.lua:388 "rpc.receive" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "No source files found.", type = 3 }}
[INFO][2023-03-07 23:31:14] ...lsp/handlers.lua:489 "No pyproject.toml file found."
[WARN][2023-03-07 23:31:14] ...lsp/handlers.lua:487 "stubPath typings is not a valid directory."
[INFO][2023-03-07 23:31:14] ...lsp/handlers.lua:489 "Assuming Python platform Linux"
[INFO][2023-03-07 23:31:14] ...lsp/handlers.lua:489 "Searching for source files"
[INFO][2023-03-07 23:31:14] ...lsp/handlers.lua:489 "No source files found."
[DEBUG][2023-03-07 23:31:15] .../lua/vim/lsp.lua:1381 "LSP[1]" "client.request" 1 "textDocument/documentHighlight" { position = { character = 0, line = 0 }, textDocument = { uri = "distant:///workspace/just_test.py" }} <function 1> 4
[DEBUG][2023-03-07 23:31:15] .../vim/lsp/rpc.lua:285 "rpc.send" { id = 3, jsonrpc = "2.0", method = "textDocument/documentHighlight", params = { position = { character = 0, line = 0 }, textDocument = { uri = "distant:///workspace/just_test.py" } }}
The text was updated successfully, but these errors were encountered: