Skip to content

Commit 52c8e09

Browse files
committed
feat(completion): add icons to sources
1 parent 18e30f5 commit 52c8e09

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lua/opencode/ui/completion/commands.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
local icons = require('lua.opencode.ui.icons')
12
local M = {}
23

34
local function get_available_commands()
@@ -24,9 +25,6 @@ local command_source = {
2425
name = 'commands',
2526
priority = 1,
2627
complete = function(context)
27-
local config = require('opencode.config')
28-
local input_text = vim.api.nvim_buf_get_lines(0, 0, -1, false)
29-
3028
if not context.line:match('^' .. vim.pesc(context.trigger_char) .. '[^%s/]*$') then
3129
return {}
3230
end
@@ -49,6 +47,7 @@ local command_source = {
4947
local item = {
5048
label = command.name .. (command.args and ' *' or ''),
5149
kind = 'command',
50+
kind_icon = icons.get('command'),
5251
detail = command.description,
5352
documentation = command.documentation .. (command.args and '\n\n* This command takes arguments.' or ''),
5453
insert_text = command.name,

lua/opencode/ui/completion/files.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local config = require('opencode.config')
2+
local icons = require('opencode.ui.icons')
23
local M = {}
34

45
local last_successful_tool = nil
@@ -95,6 +96,7 @@ local function create_file_item(file, suffix)
9596
return {
9697
label = display_label .. (suffix or ''),
9798
kind = kind,
99+
kind_icon = icons.get(kind),
98100
detail = detail,
99101
documentation = 'Path: ' .. detail,
100102
insert_text = file_path,

lua/opencode/ui/icons.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ local presets = {
2222
snapshot = '󰻛 ',
2323
restore_point = '󱗚 ',
2424
file = '',
25+
folder = '',
2526
attached_file = '󰌷 ',
2627
agent = '󰚩 ',
2728
-- statuses
@@ -37,6 +38,7 @@ local presets = {
3738
warning = '',
3839
info = '',
3940
selection = '󰫙 ',
41+
command = '',
4042
},
4143
text = {
4244
-- headers
@@ -56,6 +58,7 @@ local presets = {
5658
snapshot = '::',
5759
restore_point = '::',
5860
file = '@',
61+
folder = '[@]',
5962
attached_file = '@',
6063
agent = '@',
6164
-- statuses
@@ -71,6 +74,7 @@ local presets = {
7174
warning = '[W]',
7275
info = '[I] ',
7376
selection = "'<'> ",
77+
command = '::',
7478
},
7579
}
7680

0 commit comments

Comments
 (0)