-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblink.lua
More file actions
96 lines (96 loc) · 3.04 KB
/
blink.lua
File metadata and controls
96 lines (96 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---@type LazyPluginSpec
return {
"Saghen/blink.cmp",
branch = "v1",
dependencies = { "L3MON4D3/LuaSnip" },
event = { "InsertEnter", "CmdlineEnter" },
build =
---@param plugin LazyPlugin
function(plugin)
-- Check if cargo is available
if vim.fn.executable("cargo") ~= 1 then
vim.notify(
"[blink.cmp] cargo not found -> Lua fallback (no native fuzzy matching)",
vim.log.levels.INFO,
{ title = "blink.cmp" }
)
return
end
vim.notify(
"[blink.cmp] Compiling Rust binary...",
vim.log.levels.INFO,
{ title = "blink.cmp" }
)
-- Run the build command inside the plugin directory
vim.system(
{ "cargo", "build", "--release" },
{ cwd = plugin.dir },
function(obj)
-- Callback runs off the main thread → schedule back to UI
vim.schedule(function()
if obj.code == 0 then
vim.notify(
"[blink.cmp] Build complete",
vim.log.levels.INFO,
{ title = "blink.cmp" }
)
else
vim.notify(
("[blink.cmp] Build failed:\n%s"):format(
obj.stderr or "No error output"
),
vim.log.levels.ERROR,
{ title = "blink.cmp" }
)
end
end)
end
)
end,
opts = {
cmdline = { completion = { menu = { auto_show = true } } },
completion = {
menu = {
border = "rounded",
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind", "source_name", gap = 1 },
},
},
},
documentation = {
auto_show = true,
window = {
border = "rounded",
scrollbar = true,
winhighlight = table.concat({
"Normal:BlinkCmpMenu",
"NormalFloat:BlinkCmpMenu",
"FloatBorder:BlinkCmpMenuBorder",
"CursorLine:BlinkCmpDocCursorLine",
"Search:None",
}, ","),
},
},
},
-- enabled = function()
-- -- Disable auto-completion for certain file types
-- local disabled_filetypes = {
-- markdown = true,
-- text = true,
-- }
-- return not disabled_filetypes[vim.bo.filetype]
-- end,
fuzzy = {
implementation = vim.fn.executable("cargo") == 1 and "prefer_rust"
or "lua",
},
keymap = { ["<CR>"] = { "accept", "fallback" } },
signature = {
enabled = true,
window = { border = "rounded" },
},
snippets = { preset = "luasnip" },
},
}