Skip to content

Commit abc1e2a

Browse files
committed
feat(completion): add folder icon kind
1 parent 031bf0a commit abc1e2a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lua/opencode/ui/completion/engines/blink_cmp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Source:get_completions(ctx, callback)
5555
for i, item in ipairs(source_items) do
5656
table.insert(items, {
5757
label = item.label,
58-
kind = item.kind == 'file' and 17 or 1, -- 17: File, 1: Text
58+
kind = item.kind == 'file' and 17 or item.kind == 'folder' and 19 or 1, -- 17: File, 19: Folder, 1: Text
5959
detail = item.detail,
6060
documentation = item.documentation,
6161
insertText = item.insert_text or item.label,

lua/opencode/ui/completion/engines/nvim_cmp.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ function M.setup(completion_sources)
5555
for j, item in ipairs(source_items) do
5656
table.insert(items, {
5757
label = item.label,
58-
kind = item.kind == 'file' and cmp.lsp.CompletionItemKind.File or cmp.lsp.CompletionItemKind.Text,
58+
kind = item.kind == 'file' and cmp.lsp.CompletionItemKind.File
59+
or item.kind == 'folder' and cmp.lsp.CompletionItemKind.Folder
60+
or cmp.lsp.CompletionItemKind.Text,
5961
detail = item.detail,
6062
documentation = item.documentation,
6163
insertText = item.insert_text or item.label,

lua/opencode/ui/completion/files.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ local function create_file_item(file, suffix)
9191
if #display_label > max_display_len then
9292
display_label = '...' .. display_label:sub(-(max_display_len - 3))
9393
end
94-
94+
local kind = vim.endswith(file, '/') and 'folder' or 'file'
9595
return {
9696
label = display_label .. (suffix or ''),
97-
kind = 'file',
97+
kind = kind,
9898
detail = detail,
9999
documentation = 'Path: ' .. detail,
100100
insert_text = file_path,

0 commit comments

Comments
 (0)