lsp: Check if language server supports workspace/symbol request (#27491)

This ensures that we do not get a bunch of error logs when using the
symbol search:
```
[2025-03-26T13:23:32+01:00 ERROR project] Method not found
[2025-03-26T13:23:32+01:00 ERROR project] Method not found
[2025-03-26T13:23:32+01:00 ERROR project] Method not found
[2025-03-26T13:23:32+01:00 ERROR project] Method not found
[2025-03-26T13:23:32+01:00 ERROR project] Method not found
[2025-03-26T13:23:33+01:00 ERROR project] Method not found
...
```

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-03-26 14:09:41 +01:00 committed by GitHub
parent 1d9c581ae0
commit 1e22faebc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 43 deletions

View file

@ -270,6 +270,7 @@ mod tests {
use futures::StreamExt;
use gpui::{SemanticVersion, TestAppContext, VisualContext};
use language::{FakeLspAdapter, Language, LanguageConfig, LanguageMatcher};
use lsp::OneOf;
use project::FakeFs;
use serde_json::json;
use settings::SettingsStore;
@ -298,8 +299,16 @@ mod tests {
},
None,
)));
let mut fake_servers =
language_registry.register_fake_lsp("Rust", FakeLspAdapter::default());
let mut fake_servers = language_registry.register_fake_lsp(
"Rust",
FakeLspAdapter {
capabilities: lsp::ServerCapabilities {
workspace_symbol_provider: Some(OneOf::Left(true)),
..Default::default()
},
..Default::default()
},
);
let _buffer = project
.update(cx, |project, cx| {