From cf25246a632a831ed2cebb0b496fd38f313830e3 Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Sat, 4 Jan 2025 18:58:25 -0500 Subject: [PATCH] refactor: revert remove dead `context.get_keyword` Closes #891 6df3f68 'refactor: remove dead `context.get_keyword`' --- lua/blink/cmp/completion/trigger/context.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/blink/cmp/completion/trigger/context.lua b/lua/blink/cmp/completion/trigger/context.lua index 26afe5be..a6b36ca0 100644 --- a/lua/blink/cmp/completion/trigger/context.lua +++ b/lua/blink/cmp/completion/trigger/context.lua @@ -17,6 +17,7 @@ --- @field providers string[] --- --- @field new fun(opts: blink.cmp.ContextOpts): blink.cmp.Context +--- @field get_keyword fun(): string --- @field within_query_bounds fun(self: blink.cmp.Context, cursor: number[]): boolean --- --- @field get_mode fun(): blink.cmp.Mode @@ -64,6 +65,12 @@ function context.new(opts) }, { __index = context }) end +function context.get_keyword() + local keyword = require('blink.cmp.config').completion.keyword + local range = context.get_bounds(keyword.range) + return string.sub(context.get_line(), range.start_col, range.start_col + range.length - 1) +end + --- @param cursor number[] --- @return boolean function context:within_query_bounds(cursor)