fix autocomplete

This commit is contained in:
2026-04-07 17:12:47 +01:00
parent 6d525d0971
commit fd2307eb0c
3 changed files with 36 additions and 30 deletions
+25 -1
View File
@@ -32,6 +32,23 @@ return {
},
"folke/lazydev.nvim",
},
config = function(_, opts)
-- Monkey-patch blink's text_edits.get_from_item to clamp textEdit ranges
-- that extend past the cursor. Workaround for tsgo sending bad ranges
-- that eat text (e.g. in JSX string attributes like className="...").
local text_edits = require("blink.cmp.lib.text_edits")
local original_get_from_item = text_edits.get_from_item
text_edits.get_from_item = function(item)
local text_edit = original_get_from_item(item)
local cursor_col = require("blink.cmp.completion.trigger.context").get_cursor()[2]
if text_edit.range and text_edit.range["end"].character > cursor_col then
text_edit.range["end"].character = cursor_col
end
return text_edit
end
require("blink.cmp").setup(opts)
end,
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
@@ -76,9 +93,16 @@ return {
},
sources = {
default = { "lsp", "path", "snippets", "lazydev" },
default = { "lsp", "path", "snippets", "lazydev", "minuet" },
providers = {
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
minuet = {
name = "minuet",
module = "minuet.blink",
async = true,
timeout_ms = 3000,
score_offset = 50,
},
},
},