Skip to content

Commit

Permalink
lsp: Accept but ignore cancelled requests (StyraInc#642)
Browse files Browse the repository at this point in the history
I have not been able to work out why these are sent but they don't seem
to impact the running functionality of the server and supporting them
seems to be optional.

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#dollarRequests

For now, this updates the server to do nothing when receiving such a
request. This avoids some log lines that we don't do anything about.

I would like to come back to this though as it seems like there's more
here that we might be missing. So it has been labelled as TODO.

Signed-off-by: Charlie Egan <charlie@styra.com>
  • Loading branch information
charlieegan3 authored and srenatus committed Oct 1, 2024
1 parent 5e9b983 commit 6d1449d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ func (l *LanguageServer) Handle(
return nil, fmt.Errorf("failed to close connection: %w", err)
}

return struct{}{}, nil
case "$/cancelRequest":
// TODO: this is a no-op, but is something that we should implement
// if we want to support longer running, client-triggered operations
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#dollarRequests
return struct{}{}, nil
}

Expand Down

0 comments on commit 6d1449d

Please sign in to comment.