diff --git a/lua/blink/cmp/completion/list.lua b/lua/blink/cmp/completion/list.lua index ef274e85..f0cee22f 100644 --- a/lua/blink/cmp/completion/list.lua +++ b/lua/blink/cmp/completion/list.lua @@ -106,7 +106,7 @@ end function list.fuzzy(context, items_by_source) local fuzzy = require('blink.cmp.fuzzy') - local filtered_items = fuzzy.fuzzy(context:get_keyword(), items_by_source) + local filtered_items = fuzzy.fuzzy(context.get_keyword(), items_by_source) -- apply the per source max_items filtered_items = require('blink.cmp.sources.lib').apply_max_items_for_completions(context, filtered_items) diff --git a/lua/blink/cmp/completion/trigger/context.lua b/lua/blink/cmp/completion/trigger/context.lua index d8e3fd3b..de54c24d 100644 --- a/lua/blink/cmp/completion/trigger/context.lua +++ b/lua/blink/cmp/completion/trigger/context.lua @@ -18,7 +18,7 @@ --- @field providers string[] --- --- @field new fun(opts: blink.cmp.ContextOpts): blink.cmp.Context ---- @field get_keyword fun(self: blink.cmp.Context): string +--- @field get_keyword fun(): string --- @field within_query_bounds fun(self: blink.cmp.Context, cursor: number[]): boolean --- --- @field get_mode fun(): blink.cmp.Mode @@ -59,10 +59,10 @@ function context.new(opts) }, { __index = context }) end -function context:get_keyword() +function context.get_keyword() local keyword = require('blink.cmp.config').completion.keyword - local range = self.get_regex_around_cursor(keyword.range, keyword.regex, keyword.exclude_from_prefix_regex) - return string.sub(self.line, range.start_col, range.start_col + range.length - 1) + local range = context.get_regex_around_cursor(keyword.range, keyword.regex, keyword.exclude_from_prefix_regex) + return string.sub(context.get_line(), range.start_col, range.start_col + range.length - 1) end --- @param cursor number[] diff --git a/lua/blink/cmp/completion/windows/render/context.lua b/lua/blink/cmp/completion/windows/render/context.lua index 5b1f1740..50cad71d 100644 --- a/lua/blink/cmp/completion/windows/render/context.lua +++ b/lua/blink/cmp/completion/windows/render/context.lua @@ -21,7 +21,7 @@ local draw_context = {} --- @return blink.cmp.DrawItemContext[] function draw_context.get_from_items(context, draw, items) local matched_indices = require('blink.cmp.fuzzy').fuzzy_matched_indices( - context:get_keyword(), + context.get_keyword(), vim.tbl_map(function(item) return item.label end, items) )