arduino / arduino-language-server

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

Add support for window/progress notification #151

Open ssipos90 opened 1 year ago

ssipos90 commented 1 year ago

Describe the request

Either implement or at least stop crashing when notifying for that.

Describe the current behavior

Neovim has this function that you can check if a server is ready, vim.lsp.buf.server_ready() which returns bool. If you call this function, arduino language server crashes, it can't handle that event (might be clangd who can't handle it). The function uses window/progress notification as seen in the source code:

function M.server_ready()
  return not not vim.lsp.buf_notify(0, 'window/progress', {})
end

The error logged by neovim's LSP is:

Panic: unimplemented notification: window/progress

goroutine 21 [running]:
runtime/debug.Stack()
    /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/arduino/arduino-language-server/streams.CatchAndLogPanic()
    /home/build/streams/panics.go:29 +0x74
panic({0xa353e0, 0xc0000fd8d0})
    /usr/local/go/src/runtime/panic.go:838 +0x207
go.bug.st/lsp.(*Server).notificationDispatcher(0xc000240c00, {0xc447e0, 0xc0004045d0}, {0xc000421530, 0xf}, {0xc000421520, 0x2, 0x8})
    /go/pkg/mod/go.bug.st/lsp@v0.1.2/server.go:252 +0xed4
go.bug.st/lsp/jsonrpc.(*Connection).handleIncomingNotification(0xc000190c00, 0xc00004ab80)
    /go/pkg/mod/go.bug.st/lsp@v0.1.2/jsonrpc/jsonrpc_connection.go:192 +0x1e3
go.bug.st/lsp/jsonrpc.(*Connection).handleIncomingData(0xc000190c00, {0xc000162700, 0x39, 0x39})
    /go/pkg/mod/go.bug.st/lsp@v0.1.2/jsonrpc/jsonrpc_connection.go:130 +0x156
go.bug.st/lsp/jsonrpc.(*Connection).Run(0xc000190c00)
    /go/pkg/mod/go.bug.st/lsp@v0.1.2/jsonrpc/jsonrpc_connection.go:119 +0x98
go.bug.st/lsp.(*Server).Run(...)
    /go/pkg/mod/go.bug.st/lsp@v0.1.2/server.go:134
github.com/arduino/arduino-language-server/ls.(*IDELSPServer).Run(...)
    /home/build/ls/lsp_server_ide.go:53
github.com/arduino/arduino-language-server/ls.NewINOLanguageServer.func1()
    /home/build/ls/ls.go:167 +0x5b
created by github.com/arduino/arduino-language-server/ls.NewINOLanguageServer
    /home/build/ls/ls.go:165 +0x6dc

Arduino Language Server version

0.7.4

Arduino CLI version

0.29.0-arch

Operating system

Linux

Operating system version

ManjaroLinux 22.0.1

Additional context

No response

Issue checklist