|
27 | 27 | --- @field activate fun()
|
28 | 28 | --- @field is_trigger_character fun(char: string, is_retrigger?: boolean): boolean
|
29 | 29 | --- @field suppress_events_for_callback fun(cb: fun())
|
30 |
| ---- @field show_if_on_trigger_character fun(opts?: { is_accept?: boolean }): boolean |
31 |
| ---- @field show fun(opts?: { trigger_character?: string }) |
| 30 | +--- @field show_if_on_trigger_character fun(opts?: { is_accept?: boolean }) |
| 31 | +--- @field show fun(opts?: { trigger_character?: string, force?: boolean, send_upstream?: boolean }) |
32 | 32 | --- @field hide fun()
|
33 | 33 | --- @field within_query_bounds fun(cursor: number[]): boolean
|
34 | 34 | --- @field get_context_bounds fun(regex: string): blink.cmp.ContextBounds
|
@@ -131,19 +131,17 @@ function trigger.suppress_events_for_callback(cb)
|
131 | 131 | trigger.buffer_events:suppress_events_for_callback(cb)
|
132 | 132 | end
|
133 | 133 |
|
134 |
| ---- @param opts { is_accept?: boolean } | nil |
135 | 134 | function trigger.show_if_on_trigger_character(opts)
|
136 |
| - if opts and opts.is_accept and not config.show_on_accept_on_trigger_character then return false end |
| 135 | + if opts and opts.is_accept and not config.show_on_accept_on_trigger_character then return end |
137 | 136 |
|
138 | 137 | local cursor_col = vim.api.nvim_win_get_cursor(0)[2]
|
139 | 138 | local char_under_cursor = vim.api.nvim_get_current_line():sub(cursor_col, cursor_col)
|
140 |
| - local is_on_trigger = trigger.is_trigger_character(char_under_cursor, true) |
141 | 139 |
|
142 |
| - if is_on_trigger then trigger.show({ trigger_character = char_under_cursor }) end |
143 |
| - return is_on_trigger |
| 140 | + if trigger.is_trigger_character(char_under_cursor, true) then |
| 141 | + trigger.show({ trigger_character = char_under_cursor }) |
| 142 | + end |
144 | 143 | end
|
145 | 144 |
|
146 |
| ---- @param opts { trigger_character?: string, send_upstream?: boolean, force?: boolean } | nil |
147 | 145 | function trigger.show(opts)
|
148 | 146 | opts = opts or {}
|
149 | 147 |
|
|
0 commit comments