Skip to content

Commit

Permalink
refactor: revert remove dead context.get_keyword
Browse files Browse the repository at this point in the history
Closes #891

6df3f68 'refactor: remove dead `context.get_keyword`'
  • Loading branch information
Saghen committed Jan 4, 2025
1 parent 3ab6832 commit cf25246
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/blink/cmp/completion/trigger/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cf25246

Please sign in to comment.