File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 29
29
function path :get_trigger_characters () return { ' /' , ' .' } end
30
30
31
31
function path :get_completions (context , callback )
32
+ -- we use libuv, but the rest of the library expects to be synchronous
33
+ callback = vim .schedule_wrap (callback )
34
+
32
35
local lib = require (' blink.cmp.sources.path.lib' )
33
36
34
37
local dirname = lib .dirname (PATH_REGEX , self .opts .get_cwd , context )
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ local lib = {}
4
4
--- @param get_cwd fun ( context : blink.cmp.Context ): string
5
5
--- @param context blink.cmp.Context
6
6
function lib .dirname (path_regex , get_cwd , context )
7
- local line_before_cursor = context .line :sub (1 , context .cursor [2 ])
7
+ -- HACK: move this :sub logic into the context?
8
+ -- it's not obvious that you need to avoid going back a char if the start_col == end_col
9
+ local line_before_cursor =
10
+ context .line :sub (1 , context .bounds .start_col - (context .bounds .start_col ~= context .bounds .end_col and 1 or 0 ))
8
11
local s = path_regex :match_str (line_before_cursor )
9
12
if not s then return nil end
10
13
Original file line number Diff line number Diff line change @@ -63,10 +63,14 @@ function trigger.activate_autocmds()
63
63
and not vim .tbl_contains (config .show_on_insert_blocked_trigger_characters , char_under_cursor )
64
64
local is_on_context_char = char_under_cursor :match (config .keyword_regex ) ~= nil
65
65
66
- if is_within_bounds or ( is_on_trigger and trigger . context ~= nil ) then
66
+ if is_within_bounds then
67
67
trigger .show ()
68
- -- check if we've gone 1 char behind the context and we're still on a context char
69
- elseif is_on_context_char and trigger .context ~= nil and cursor_col == trigger .context .bounds .start_col - 1 then
68
+ elseif
69
+ -- check if we've gone 1 char behind the context and we're still on a context char
70
+ (is_on_context_char and trigger .context ~= nil and cursor_col == trigger .context .bounds .start_col - 1 )
71
+ -- or if we've moved onto a trigger character
72
+ or (is_on_trigger and trigger .context ~= nil )
73
+ then
70
74
trigger .context = nil
71
75
trigger .show ()
72
76
elseif config .show_on_insert_on_trigger_character and is_on_trigger and ev .event == ' InsertEnter' then
You can’t perform that action at this time.
0 commit comments