chipsenkbeil / chipsenkbeil/distant.nvim

Cannot use LSP client from nvim

Open
#137 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Lua
Stars
1.4k
Forks
16
PR merge metrics
No merged PRs in 30d

Description

While trying to open a source file with a file type matching the one set in my config, I get the following stack trace:
```
E5108: Error executing lua: C:/Program Files/Neovim/share/nvim/runtime/lua/vim/lsp.lua:598: client_id: expected number, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua:936: in function 'validate'
C:/Program Files/Neovim/share/nvim/runtime/lua/vim/lsp.lua:598: in function 'buf_attach_client'
.../nvim-data/lazy/distant.nvim/lua/distant-core/client.lua:223: in function 'do_connect_client'
.../nvim-data/lazy/distant.nvim/lua/distant-core/client.lua:235: in function 'connect_lsp_clients'
...zy/distant.nvim/lua/distant/editor/open/configurator.lua:177: in function 'configure'
.../nvim-data/lazy/distant.nvim/lua/distant/editor/open.lua:246: in function 'open'
.../nvim-data/lazy/distant.nvim/lua/distant/nav/actions.lua:47: in function <.../nvim-data/lazy/distant.nvim/lua/distant/nav/actions.lua:41>
```
I first tried checking my configuration for anything wrong on my part, and couldn't find anything.
After that I tried printing the `config` table in `../distant-core/client.lua` before the `do_connect_client` call, and the data within seemed OK.
I also found out that the `cmd` field was set to the following:
```
"distant.exe spawn --lsp distant://1658010143 --connection 1658010143 -- /usr/bin/clangd"
```
All of the arguments seemed fine, so I did the natural thing, and tried to run the same command in the terminal, and got no errors.
On a separate terminal, I was checking the server log, and found out that when the command was sent from the terminal, the server
correctly spawned a `clangd` process, and the request was visible from the log.
When instead trying to open the source file from neovim, only 2 requests were logged: one for the file's metadata, and one for the actual data, but nothing LSP-related.

I tried connecting using an `ssh` scheme, or running neovim from a `Linux` machine, but nothing seems to work.

Concerning my current setup on windows, here is some additional info:
```
PS C:\Users\robecons\AppData\Local\nvim-data\lazy\distant.nvim> nvim --version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
```
```
Lazy output:
dir C:/Users/robecons/AppData/Local/nvim-data/lazy/distant.nvim
url https://github.com/chipsenkbeil/distant.nvim
branch v0.3
commit 823267c
```
I'm also using a configuration based on `nvchad`, and I disabled `nvim-lspconfig`, as some people pointed out that it causes some issues when paired with `distant.nvim`.

I would really to find out a way to fix this, as the single way to work remote without latency AND with LSP support is running vscode, which I just can't switch back to. (I already fell off the deep end 😄)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with distant-core/client.lua around do_connect_client and connect_lsp_clients, then trace the caller in distant/editor/open/configurator.lua. Reproduce the Windows Neovim 0.10 setup using the reported distant.nvim commit and clangd command, and inspect why no LSP request is logged. Done means opening the remote source file attaches the configured LSP client without the nil client_id error.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.