@@ -57,12 +57,12 @@ function trigger.activate()
57
57
if trigger .context ~= nil then trigger .show ({ send_upstream = false }) end
58
58
59
59
-- character forces a trigger according to the sources, create a fresh context
60
- elseif trigger .is_trigger_character (char ) and config .show_on_trigger_character then
60
+ elseif trigger .is_trigger_character (char ) and ( config .show_on_trigger_character or trigger . context ~= nil ) then
61
61
trigger .context = nil
62
62
trigger .show ({ trigger_character = char })
63
63
64
- -- character is part of the current context OR in an existing context
65
- elseif char :match (keyword_config .regex ) ~= nil and config .show_on_keyword then
64
+ -- character is part of a keyword
65
+ elseif char :match (keyword_config .regex ) ~= nil and ( config .show_on_keyword or trigger . context ~= nil ) then
66
66
trigger .show ()
67
67
68
68
-- nothing matches so hide
@@ -82,7 +82,7 @@ function trigger.activate()
82
82
local char_under_cursor = vim .api .nvim_get_current_line ():sub (cursor_col , cursor_col )
83
83
local is_on_trigger_for_show = trigger .is_trigger_character (char_under_cursor )
84
84
local is_on_trigger_for_show_on_insert = trigger .is_trigger_character (char_under_cursor , true )
85
- local is_on_context_char = char_under_cursor :match (keyword_config .regex ) ~= nil
85
+ local is_on_keyword_char = char_under_cursor :match (keyword_config .regex ) ~= nil
86
86
87
87
local insert_enter_on_trigger_character = config .show_on_trigger_character
88
88
and config .show_on_insert_on_trigger_character
@@ -100,7 +100,7 @@ function trigger.activate()
100
100
trigger .show ({ trigger_character = char_under_cursor })
101
101
102
102
-- show if we currently have a context, and we've moved outside of it's bounds by 1 char
103
- elseif is_on_context_char and trigger .context ~= nil and cursor_col == trigger .context .bounds .start_col - 1 then
103
+ elseif is_on_keyword_char and trigger .context ~= nil and cursor_col == trigger .context .bounds .start_col - 1 then
104
104
trigger .context = nil
105
105
trigger .show ()
106
106
0 commit comments