Skip to content

Commit

Permalink
refactor: support new documentation rendering API (draw)
Browse files Browse the repository at this point in the history
This api will replace the current `render` api in a future release of
blink.

Saghen/blink.cmp#1113
  • Loading branch information
mikavilpas committed Feb 14, 2025
1 parent eea5060 commit c8a0e48
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lua/blink-ripgrep/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function RgSource.new(input_opts)
return self
end

---@param opts blink.cmp.SourceRenderDocumentationOpts
---@param opts blink.cmp.CompletionDocumentationDrawOpts
---@param file blink-ripgrep.RipgrepFile
---@param match blink-ripgrep.RipgrepMatch
local function render_item_documentation(opts, file, match)
Expand Down Expand Up @@ -261,14 +261,19 @@ function RgSource:get_completions(context, resolve)
docstring = docstring .. line.text .. "\n"
end

local draw_docs = function(opts)
render_item_documentation(opts, file, match)
end

---@diagnostic disable-next-line: missing-fields
items[matchkey] = {
documentation = {
kind = "markdown",
value = docstring,
render = function(opts)
render_item_documentation(opts, file, match)
end,
draw = draw_docs,
-- legacy, will be removed in a future release of blink
-- https://github.com/Saghen/blink.cmp/issues/1113
render = draw_docs,
},
source_id = "blink-ripgrep",
kind = kinds.Text,
Expand Down

0 comments on commit c8a0e48

Please sign in to comment.