mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Use completion item default data
when provided
This commit is contained in:
parent
77ba25328c
commit
fcaf48eb49
1 changed files with 9 additions and 1 deletions
|
@ -1358,7 +1358,7 @@ impl LspCommand for GetCompletions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Default::default()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
let completions = buffer.read_with(&cx, |buffer, _| {
|
let completions = buffer.read_with(&cx, |buffer, _| {
|
||||||
|
@ -1370,6 +1370,14 @@ impl LspCommand for GetCompletions {
|
||||||
completions
|
completions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(move |mut lsp_completion| {
|
.filter_map(move |mut lsp_completion| {
|
||||||
|
if let Some(response_list) = &response_list {
|
||||||
|
if let Some(item_defaults) = &response_list.item_defaults {
|
||||||
|
if let Some(data) = &item_defaults.data {
|
||||||
|
lsp_completion.data = Some(data.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (old_range, mut new_text) = match lsp_completion.text_edit.as_ref() {
|
let (old_range, mut new_text) = match lsp_completion.text_edit.as_ref() {
|
||||||
// If the language server provides a range to overwrite, then
|
// If the language server provides a range to overwrite, then
|
||||||
// check that the range is valid.
|
// check that the range is valid.
|
||||||
|
|
Loading…
Reference in a new issue