Skip to content

Commit

Permalink
Add support for clangd >= 17
Browse files Browse the repository at this point in the history
Previous commit broke other language servers
  • Loading branch information
BorisVassilev1 committed Feb 23, 2025
1 parent c2ac54d commit ec25928
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion crates/languages/src/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,20 @@ impl super::LspAdapter for CLspAdapter {
completion: &lsp::CompletionItem,
language: &Arc<Language>,
) -> Option<CodeLabel> {
let label_detail =
match &completion.label_details {
Some(label_detail) => match &label_detail.detail {
Some(detail) => detail.trim(),
None => "",
},
None => "",
};

let label = completion
.label
.strip_prefix('•')
.unwrap_or(&completion.label)
.trim();
.trim().to_owned() + label_detail;

match completion.kind {
Some(lsp::CompletionItemKind::FIELD) if completion.detail.is_some() => {
Expand Down
2 changes: 1 addition & 1 deletion crates/lsp/src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ impl LanguageServer {
],
}),
insert_replace_support: Some(true),
label_details_support: Some(false),
label_details_support: Some(true),
..Default::default()
}),
completion_list: Some(CompletionListCapability {
Expand Down

0 comments on commit ec25928

Please sign in to comment.