clangd: Implement switch source/header extension (#14646)

Release Notes:

- Added switch source/header action for clangd language server (fixes
[#12801](https://github.com/zed-industries/zed/issues/12801)).

Note: I'm new to both rust and this codebase. I started my
implementation by copying how rust analyzer's "expand macro" LSP
extension is implemented. I don't yet understand some of the code I
copied (mostly the way to get the `server_to_query` in `clangd_ext.rs`
and the whole proto implementation).

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
Thorben Kröger
2024-08-21 22:15:08 +03:00
committed by GitHub
co-authored by Kirill Bulatov
parent 96bcceed40
commit f85ca387a7
9 changed files with 286 additions and 55 deletions
+4
View File
@@ -406,6 +406,8 @@ messages!(
(UpdateContext, Foreground),
(SynchronizeContexts, Foreground),
(SynchronizeContextsResponse, Foreground),
(LspExtSwitchSourceHeader, Background),
(LspExtSwitchSourceHeaderResponse, Background),
(AddWorktree, Foreground),
(AddWorktreeResponse, Foreground),
);
@@ -528,6 +530,7 @@ request_messages!(
(OpenContext, OpenContextResponse),
(CreateContext, CreateContextResponse),
(SynchronizeContexts, SynchronizeContextsResponse),
(LspExtSwitchSourceHeader, LspExtSwitchSourceHeaderResponse),
(AddWorktree, AddWorktreeResponse),
);
@@ -597,6 +600,7 @@ entity_messages!(
CreateContext,
UpdateContext,
SynchronizeContexts,
LspExtSwitchSourceHeader
);
entity_messages!(