-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Describe the problem
The language server crashes (panics) when receiving a textDocument/inlayHint request. Even though this capability is not advertised by the server, some LSP clients (like Neovim) may still send the request, leading to a fatal error and server exit.
To reproduce
Initialize the arduino-language-server using a client that has inlay hints enabled (e.g., Neovim 0.10+).
Open an Arduino sketch.
Observe the server crashing shortly after initialization when the client attempts to fetch inlay hints.
Expected behavior
The language server should not crash when receiving a textDocument/inlayHint request.
If the server does not support Inlay Hints, it should either:
Ignore the request and return an empty result ({ "items": [] }) or null.
Properly advertise its capabilities during the initialize handshake so that the client (Neovim) knows not to send the request in the first place.
Currently, the server's request dispatcher panics on any method it hasn't explicitly implemented, which makes the server brittle when used with modern LSP clients that have these features enabled by default.
Arduino Language Server version
arduino-language-server: 0.7.7 (Commit: 9945da3, Date: 2025-03-19)
Arduino CLI version
arduino-cli Version: 1.4.1 Commit: e39419312 Date: 2026-01-19T16:13:12Z
Operating system
Linux
Operating system version
Manjaro 26.0.1
Additional context
log output
panic: unimplemented request: textDocument/inlayHint [recovered]
panic: unimplemented request: textDocument/inlayHint
goroutine 9 [running]:
github.com/arduino/arduino-language-server/streams.CatchAndLogPanic()
/home/build/streams/panics.go:30 +0x188
panic({0xa6fba0?, 0xc0002f3300?})
/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.1.linux-amd64/src/runtime/panic.go:792 +0x132
go.bug.st/lsp.(*Server).requestDispatcher(0xc0001d4ab0?, {0xc92628, 0xc00018cbe0}, {0xc8b740, 0xc0004d4960}, {0xc0004fcd80, 0x16}, {0xc0001400d0, 0xc1, 0xd0}, ...)
/go/pkg/mod/go.bug.st/lsp@v0.1.3/server.go:565 +0x2bc5
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest version
- My report contains all necessary details