Skip to content

Commit ffc4282

Browse files
committed
feat: support LSP item defaults
1 parent 3cb084c commit ffc4282

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/blink/cmp/sources/lsp.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ function lsp:get_completions(context, callback)
113113
end
114114
end
115115

116-
-- add client_id to the items
116+
-- add client_id and defaults to the items
117117
for client_id, response in pairs(responses) do
118+
local defaults = response.result and response.result.itemDefaults or {}
118119
for _, item in ipairs(response.items) do
119120
-- todo: terraform lsp doesn't return a .kind in situations like `toset`, is there a default value we need to grab?
120121
-- it doesn't seem to return itemDefaults either
@@ -123,6 +124,11 @@ function lsp:get_completions(context, callback)
123124

124125
-- todo: make configurable
125126
if item.deprecated or (item.tags and vim.tbl_contains(item.tags, 1)) then item.score_offset = -2 end
127+
128+
-- add defaults to the item
129+
for key, value in pairs(defaults) do
130+
item[key] = value
131+
end
126132
end
127133
end
128134

0 commit comments

Comments
 (0)