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
97
|
return {
{
"lazydev.nvim",
-- NOTE: if lazyloaded, blink will break as `lze` doesn't packadd this package...
-- ft = "lua",
after = function(_)
-- NOTE: this is required to fix strange filtering in `lazydev.nvim`
--- @diagnostic disable-next-line: duplicate-set-field
require("lazydev.lsp").supports = function(client)
local client_names = {
-- Default client names from `lazydev.nvim`
"lua_ls",
"emmylua-analyzer-rust",
-- NOTE: I have `lua-language-server` name which was not in list
"lua-language-server",
}
return client and vim.tbl_contains(client_names, client.name)
end
require("lazydev").setup({
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
{ path = "snacks.nvim", words = { "Snacks" } },
},
})
end,
},
{
"blink.cmp",
event = "DeferredUIEnter",
after = function(_)
require("blink.cmp").setup({
appearance = {
use_nvim_cmp_as_default = false,
nerd_font_variant = "mono",
},
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 500,
},
ghost_text = { enabled = true },
},
cmdline = {
completion = {
ghost_text = { enabled = false },
},
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
},
},
fuzzy = {
sorts = { "exact", "score", "sort_text" },
},
keymap = {
-- TODO: come up with more convenient keybinding
-- ["<S-space>"] = { "show", "show_documentation", "hide_documentation" },
["<M-->"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
["<Tab>"] = { "snippet_forward", "fallback" },
["<S-Tab>"] = { "snippet_backward", "fallback" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
["<C-p>"] = { "select_prev", "fallback_to_mappings" },
["<C-n>"] = { "select_next", "fallback_to_mappings" },
["<C-b>"] = { "scroll_documentation_up", "fallback" },
["<C-f>"] = { "scroll_documentation_down", "fallback" },
},
})
-- NOTE: this is broken due to something
-- local client_capabilities = vim.lsp.protocol.make_client_capabilities()
-- local blink_capabilities = require("blink.cmp").get_lsp_capabilities()
-- local capabilities = vim.tbl_deep_extend('force', client_capabilities, blink_capabilities)
-- vim.lsp.config("*", { capabilities = capabilities })
end,
},
}
|