fix builtin completions if label_details_support is false (#924)

This commit is contained in:
Techatrix 2023-01-21 01:33:27 +01:00 committed by GitHub
parent fa5828496e
commit 1ed8d49b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1326,16 +1326,15 @@ fn completeBuiltin(server: *Server) error{OutOfMemory}!?[]types.CompletionItem {
});
}
var completions = try allocator.alloc(types.CompletionItem, builtin_completions.items.len);
var completions = try builtin_completions.clone(allocator);
if (server.client_capabilities.label_details_support) {
for (builtin_completions.items) |item, i| {
completions[i] = item;
try formatDetailledLabel(&completions[i], allocator);
for (completions.items) |*item| {
try formatDetailledLabel(item, allocator);
}
}
return completions;
return completions.items;
}
fn completeGlobal(server: *Server, pos_index: usize, handle: *const DocumentStore.Handle) error{OutOfMemory}![]types.CompletionItem {