arduino / arduino-language-server

An Arduino Language Server based on Clangd to Arduino code autocompletion
GNU Affero General Public License v3.0
120 stars 11 forks source link

Ignore workspace/didChangeConfiguration #114

Closed joewreschnig closed 2 years ago

joewreschnig commented 2 years ago

Describe the request

The eglot LSP client for Emacs sends the workspace/didChangeConfiguration notification by default on startup (and if configuration changes later).

arduino-language-server currently panics and dies if it receives this notification. However, since it's just a notification and doesn't demand the language server actually do anything, it seems like while unsupported it would be more useful as a no-op rather than a panic.

Describe the current behavior

The server panics when eglot connects and sends workspace/didChangeConfiguration.

[stderr] 2022/06/18 17:28:20 IDE --> LS NOTIF workspace/didChangeConfiguration
[stderr] 2022/06/18 17:28:20 Panic: unimplemented
[stderr] 
[stderr] goroutine 8 [running]:
[stderr] runtime/debug.Stack()
[stderr]    /home/piman/sdk/go1.18/src/runtime/debug/stack.go:24 +0x65
[stderr] github.com/arduino/arduino-language-server/streams.CatchAndLogPanic()
[stderr]    /home/piman/go/pkg/mod/github.com/arduino/arduino-language-server@v0.0.0-20220105094946-835a2f524a60/streams/panics.go:14 +0x74
[stderr] panic({0x9f4fa0, 0xbeba90})
[stderr]    /home/piman/sdk/go1.18/src/runtime/panic.go:838 +0x207
[stderr] github.com/arduino/arduino-language-server/ls.(*IDELSPServer).WorkspaceDidChangeConfiguration(0xc0002cc1c8?, {0x11?, 0x18?}, 0x9d4880?)
[stderr]    /home/piman/go/pkg/mod/github.com/arduino/arduino-language-server@v0.0.0-20220105094946-835a2f524a60/ls/lsp_server_ide.go:232 +0x27
etc

Arduino Language Server version

0.6.0

Arduino CLI version

0.23.0

Operating system

Linux

Operating system version

Debian 11.3

Additional context

For anyone finding this and trying to work around the issue, setting eglot-connect-hook to nil will disable the call on startup, but it may still be fired later. eglot-connect-hook is also flagged as a risky local variable which may require changing your enable-local-variables setting to load properly.

Issue checklist

cmaglie commented 2 years ago

Fixed by #121