File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -85,9 +85,14 @@ function trigger.activate_autocmds()
85
85
local cursor_col = vim .api .nvim_win_get_cursor (0 )[2 ]
86
86
local char_under_cursor = vim .api .nvim_get_current_line ():sub (cursor_col , cursor_col )
87
87
local is_on_trigger = vim .tbl_contains (sources .get_trigger_characters (), char_under_cursor )
88
+ local is_on_context_char = char_under_cursor :match (trigger .context_regex ) ~= nil
88
89
89
90
if is_within_bounds or (is_on_trigger and trigger .context ~= nil ) then
90
91
trigger .show ()
92
+ -- check if we've gone 1 char behind the context and we're still on a context char
93
+ elseif is_on_context_char and trigger .context ~= nil and cursor_col == trigger .context .bounds .start_col - 1 then
94
+ trigger .context = nil
95
+ trigger .show ()
91
96
elseif config .show_on_insert_on_trigger_character and is_on_trigger and ev .event == ' InsertEnter' then
92
97
trigger .show ({ trigger_character = char_under_cursor })
93
98
else
@@ -182,7 +187,8 @@ function helpers.get_context_bounds(regex)
182
187
end_col = end_col + 1
183
188
end
184
189
185
- return { line_number = cursor_line , start_col = start_col , end_col = end_col }
190
+ -- hack: why do we have to math.min here?
191
+ return { line_number = cursor_line , start_col = math.min (start_col , end_col ), end_col = end_col }
186
192
end
187
193
188
194
return trigger
You can’t perform that action at this time.
0 commit comments