Show status of LSP actions (#9818)

Fixes #4380

Parts im still unsure about:
- [x] where exactly I should call `on_lsp_start`/`on_lsp_end`
- [x] how to handle things better than `let is_references =
TypeId::of::<R>() == TypeId::of::<GetReferences>();`, which feels very
janky
- [x] I want to have the message be something like `"Finding references
to [...]"` instead of just `textDocument/references`, but I'm not sure
how to retrieve the name of the symbol that's being queried
- [ ] I think the bulk of the runtime is occupied by `let result =
language_server.request::<R::LspRequest>(lsp_params).await;`, but since
`ModelContext` isn't passed into it, I'm not sure how to update progress
from within that function
- [x] A good way to disambiguate between multiple calls to the same lsp
function; im currently using the function name itself as the unique
identifier for that request, which could create issues if multiple
`textDocument/references` requests are sent in parallel

Any help with these would be deeply appreciated!

Release Notes:

- Adds a status indicator for LSP actions

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Daniel Zhu 2024-04-06 22:48:11 -04:00 committed by GitHub
parent c7961b9054
commit 4944dc9d78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 99 additions and 22 deletions

View file

@ -41,6 +41,10 @@ pub trait LspCommand: 'static + Sized + Send {
true
}
fn status(&self) -> Option<String> {
None
}
fn to_lsp(
&self,
path: &Path,
@ -895,6 +899,10 @@ impl LspCommand for GetReferences {
type LspRequest = lsp::request::References;
type ProtoRequest = proto::GetReferences;
fn status(&self) -> Option<String> {
return Some("Finding references...".to_owned());
}
fn to_lsp(
&self,
path: &Path,