lsp: Provide completion reason in the request (#12893)

This should help LS make a better call about the completions it should
return back to the caller. For example, it speeds up import completions
for typescript.
Before: 


https://github.com/zed-industries/zed/assets/24362066/b38fd565-f9ff-4db7-a87f-c3b31a9fdc96

after: 


https://github.com/zed-industries/zed/assets/24362066/d4fbc9ae-9aab-4543-b9f6-16acf1619576


This should be merged after 06.12 Preview to give it some time on
Nightly.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-06-13 14:38:34 +02:00 committed by GitHub
parent eb7b5a7131
commit 0a13b9ee01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 86 additions and 26 deletions

View file

@ -15,7 +15,7 @@ use http::{FakeHttpClient, Response};
use language::{LanguageMatcher, LanguageRegistry, LanguageServerBinaryStatus, LanguageServerName};
use node_runtime::FakeNodeRuntime;
use parking_lot::Mutex;
use project::Project;
use project::{Project, DEFAULT_COMPLETION_CONTEXT};
use serde_json::json;
use settings::{Settings as _, SettingsStore};
use std::{
@ -657,7 +657,9 @@ async fn test_extension_store_with_gleam_extension(cx: &mut TestAppContext) {
});
let completion_labels = project
.update(cx, |project, cx| project.completions(&buffer, 0, cx))
.update(cx, |project, cx| {
project.completions(&buffer, 0, DEFAULT_COMPLETION_CONTEXT, cx)
})
.await
.unwrap()
.into_iter()