Skip to content

Commit

Permalink
feat: show on insert on trigger character
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Oct 2, 2024
1 parent 210f21f commit a9ff243
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/blink/cmp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
--- @class blink.cmp.TriggerConfig
--- @field context_regex string
--- @field blocked_trigger_characters string[]
--- @field show_on_insert_on_trigger_character boolean When true, will show the completion window when the cursor comes after a trigger character when entering insert mode

--- @class blink.cmp.SourceConfig
--- @field providers blink.cmp.SourceProviderConfig[][]
Expand Down Expand Up @@ -92,6 +93,7 @@ local config = {
trigger = {
context_regex = '[%w_\\-]',
blocked_trigger_characters = { ' ', '\n', '\t' },
show_on_insert_on_trigger_character = true,
},
fuzzy = {
use_frecency = true,
Expand Down
5 changes: 3 additions & 2 deletions lua/blink/cmp/trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
--- @field context_regex string
--- @field event_targets blink.cmp.TriggerEventTargets

local config = require('blink.cmp.config').trigger
local sources = require('blink.cmp.sources.lib')

--- @class blink.cmp.Trigger
Expand Down Expand Up @@ -86,8 +87,8 @@ function trigger.activate_autocmds()

if is_within_bounds or (is_on_trigger and trigger.context ~= nil) then
trigger.show()
-- elseif is_on_trigger and ev.event == 'InsertEnter' then
-- trigger.show({ trigger_character = char_under_cursor })
elseif config.show_on_insert_on_trigger_character and is_on_trigger and ev.event == 'InsertEnter' then
trigger.show({ trigger_character = char_under_cursor })
else
trigger.hide()
end
Expand Down

0 comments on commit a9ff243

Please sign in to comment.