"nvim" LSP client detach from arduino-language-server with error Unresolved .ino path on textDocument/definition method, when the definition is located on a "not tracked" file.
I learned from the source code that the "tracked files" are those which are saved from textDocument/didOpen methods. and to send that from "nvim", I just open the file containing the definition once.
To reproduce
Create a sketch using arduino-cli
arduino-cli sketch new test_server
Create another file(callme.ino) along with the main sketch file(test_server.ino)
5. Using [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) configure LSP client by adding the following to your `init.lua`
```lua
require'lspconfig'.arduino_language_server.setup{
filetypes = {"arduino", "cpp"},
cmd = {"arduino-language-server",
"-cli-config",
"<PATH-TO-CONFIG/arduino-cli.yaml>",
"-log",
"-logpath",
"<PATH-TO-LOG-FOLDER>"}
}
Open nvim
nvim test_server.ino
Move the cursor to callme function call and run
:lua vim.lsp.buf.definition()
Expected behavior
From the text editor point of view, the callme.ino file should get opened and the cursor should be on the function callme.
Arduino Language Server version
0.7.4 and latest main branch commit 6c64232f29f8e61
The only workaround that leads to opening the definition is by opening the callme.ino file :e callme.ino explicitly once before trying to call textDocument/definition.
Describe the problem
"nvim" LSP client detach from arduino-language-server with error
Unresolved .ino path
ontextDocument/definition
method, when the definition is located on a "not tracked" file. I learned from the source code that the "tracked files" are those which are saved fromtextDocument/didOpen
methods. and to send that from "nvim", I just open the file containing the definition once.To reproduce
callme.ino
test_server.ino
void setup() { callme(); } void loop() { }
callme
function call and runExpected behavior
From the text editor point of view, the
callme.ino
file should get opened and the cursor should be on the functioncallme
.Arduino Language Server version
0.7.4 and latest main branch commit
6c64232f29f8e61
Arduino CLI version
0.27.1
Operating system
Linux
Operating system version
Ubuntu 22
Additional context
Logged Error.
I fixed the problem suppressing the error by changing the
idePathToIdeURI()
function toBut I do not think this is a good solution and would introduce other problems.
Other tries I made
I tried to open the project with several commands but all gave the same behavior.
The only workaround that leads to opening the definition is by opening the
callme.ino
file:e callme.ino
explicitly once before trying to calltextDocument/definition
.Issue checklist