@@ -30,13 +30,17 @@ function M._get_trigger(before_cursor)
3030 local config = require (' opencode.config' )
3131 local mention_key = config .get_key_for_function (' input_window' , ' mention' )
3232 local slash_key = config .get_key_for_function (' input_window' , ' slash_commands' )
33+ local context_key = config .get_key_for_function (' input_window' , ' context_items' )
3334 local triggers = {}
3435 if mention_key then
3536 table.insert (triggers , mention_key )
3637 end
3738 if slash_key then
3839 table.insert (triggers , slash_key )
3940 end
41+ if context_key then
42+ table.insert (triggers , context_key )
43+ end
4044 local trigger_chars = table.concat (vim .tbl_map (vim .pesc , triggers ), ' ' )
4145 local trigger_char , trigger_match = before_cursor :match (' .*([' .. trigger_chars .. ' ])([%w_%-%.]*)' )
4246 return trigger_char , trigger_match
@@ -88,8 +92,8 @@ function M._update()
8892 item .insert_text = item .insert_text :sub (2 )
8993 end
9094 table.insert (items , {
91- word = item .insert_text ,
92- abbr = item .label ,
95+ word = # item .insert_text > 0 and item . insert_text or item . label ,
96+ abbr = ( item . kind_icon or ' ' ) .. item .label ,
9397 menu = source .name ,
9498 kind = item .kind :sub (1 , 1 ):upper (),
9599 user_data = item ,
0 commit comments