Skip to content

Commit

Permalink
fix(sources): set default item kind to Property (#505)
Browse files Browse the repository at this point in the history
* fix(sources): set default item kind to `Property`

also remove the default kind from the LSP source because this is now
handled at the sources level

* refactor: set default kind in main loop over items

---------

Co-authored-by: Liam Dyer <liamcdyer@gmail.com>
  • Loading branch information
stefanboca and Saghen authored Dec 12, 2024
1 parent 4d099ee commit 08ff824
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lua/blink/cmp/sources/lib/provider/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ function list:append(response)
self.items = {}
end

-- add non-lsp metadata
-- add metadata and default kind
local source_score_offset = self.provider.config.score_offset(self.context) or 0
for _, item in ipairs(response.items) do
item.score_offset = (item.score_offset or 0) + source_score_offset
item.cursor_column = self.context.cursor[2]
item.source_id = self.provider.id
item.source_name = self.provider.name
item.kind = item.kind or require('blink.cmp.types').CompletionItemKind.Property
end

-- combine with existing items
Expand Down
4 changes: 0 additions & 4 deletions lua/blink/cmp/sources/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ function lsp:get_completions(context, callback)

-- add defaults, client id and score offset to the items
for _, item in ipairs(items) do
-- todo: terraform lsp doesn't return a .kind in situations like `toset`, is there a default value we need to grab?
-- it doesn't seem to return itemDefaults
item.kind = item.kind or require('blink.cmp.types').CompletionItemKind.Text

item.client_id = client.id

-- todo: make configurable
Expand Down

0 comments on commit 08ff824

Please sign in to comment.