Skip to content
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

Arduino Language Server does not attach #3209

Closed
mike-lloyd03 opened this issue Jun 19, 2024 · 4 comments
Closed

Arduino Language Server does not attach #3209

mike-lloyd03 opened this issue Jun 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@mike-lloyd03
Copy link

Description

I have followed all of the instructions for setting up arduino-language-server. But when I open an arduino file in nvim, the client does not attach.

LspInfo:

 Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: /home/mike/.local/state/nvim/lsp.log
 Detected filetype:   arduino
 
 0 client(s) attached to this buffer: 
 
 Other clients that match the filetype: arduino
 
 Config: arduino_language_server
 	filetypes:         arduino
 	root directory:    /home/mike/repos/hoverboard-firmware
 	cmd:               /usr/bin/arduino-language-server
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: arduino_language_server, typst_lsp, nil_ls, kotlin_language_server, ccls, jsonls, eslint, tsserver, pyright, gopls, bashls, ansiblels, lua_ls, svelte

The client is recognized but it will not attach to the file. LspStart does nothing.

LspLog

[START][2024-06-19 15:06:51] LSP logging initiated
[ERROR][2024-06-19 15:06:51] .../vim/lsp/rpc.lua:770	"rpc"	"/usr/bin/arduino-language-server"	"stderr"	"15:06:51.296123 ArduinoCLI config file found at /home/mike/.arduino15/arduino-cli.yaml\n15:06:51.296203 arduino-cli found at /usr/bin/arduino-cli\n15:06:51.296240 clangd found at /usr/bin/clangd\n15:06:51.296311 \27[97mLS: : Initial board configuration: \27[0m\n15:06:51.296317 \27[97mLS: : arduino-language-server Version: 0.0.0-git Commit:  Date: \27[0m\n15:06:51.296351 \27[97mLS: : Language server temp directory: /tmp/arduino-language-server3308433109\27[0m\n15:06:51.296357 \27[97mLS: : Language server build path: /tmp/arduino-language-server3308433109/build\27[0m\n15:06:51.296360 \27[97mLS: : Language server build sketch root: /tmp/arduino-language-server3308433109/build/sketch\27[0m\n15:06:51.296362 \27[97mLS: : Language server FULL build path: /tmp/arduino-language-server3308433109/fullbuild\27[0m\n15:06:51.296947 IN Elapsed: 507.876µs\n15:06:51.297085 \27[92mIDE --> LS REQU initialize 1\27[0m\n"

It looks like the language server outputs text on stderr. Is it possible that nvim is interpreting output on stderr as an error?

Relevant config:

require("lspconfig").arduino_language_server.setup({})

It appears that the LSP is running:

$ procs arduino 

 PID:▲  User │ TTY CPU MEM CPU Time │ Command
             │     [%] [%]          │
 290410 mike │     0.0 0.0 00:00:00 │ /usr/bin/arduino-language-server
@mike-lloyd03 mike-lloyd03 added the bug Something isn't working label Jun 19, 2024
@fspv
Copy link

fspv commented Jun 19, 2024

Same here. Literally debugging the same problem right now. Everything seems to be working, but the buffer doesn't attach. I assume that arduino might require certain files, but not sure what else does it need apart from

./sketch.yaml
./test.ino
~/.arduino15/arduino-cli.yaml

@fspv
Copy link

fspv commented Jun 19, 2024

Found this arduino/arduino-language-server#187

Somebody says it is something broken in nvim 0.10, and 0.9.5 works well. Haven't tried this myself

@fspv
Copy link

fspv commented Jun 20, 2024

Described the bug here arduino/arduino-language-server#187 (comment)

It is not related to the nvim, but rather caused by the outdated library, which doesn't support new LSP capabilities added in nvim 0.10

@mike-lloyd03
Copy link
Author

You are correct. I downgraded to nvim 0.9.5 and the LS is working.

Kinda funny that we were having the same problem at the same time. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants