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

@ -26,7 +26,7 @@ use language::{
tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, FakeLspAdapter,
Language, LanguageConfig, LanguageMatcher, LineEnding, OffsetRangeExt, Point, Rope,
};
use lsp::LanguageServerId;
use lsp::{LanguageServerId, OneOf};
use parking_lot::Mutex;
use pretty_assertions::assert_eq;
use project::{
@ -5399,9 +5399,16 @@ async fn test_project_symbols(
let active_call_a = cx_a.read(ActiveCall::global);
client_a.language_registry().add(rust_lang());
let mut fake_language_servers = client_a
.language_registry()
.register_fake_lsp("Rust", Default::default());
let mut fake_language_servers = client_a.language_registry().register_fake_lsp(
"Rust",
FakeLspAdapter {
capabilities: lsp::ServerCapabilities {
workspace_symbol_provider: Some(OneOf::Left(true)),
..Default::default()
},
..Default::default()
},
);
client_a
.fs()