diff options
feat: use `lazydev.nvim` for better NeoVim lua suggestions
Diffstat (limited to '')
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | lua/config/plugins/completion.lua | 37 | 
2 files changed, 37 insertions, 2 deletions
| @@ -227,7 +227,7 @@                completion = [ blink-cmp ];                # NOTE: On NeoVim 0.11+ nvim-lspconfig is not required due to native API -              lsp = [ ]; +              lsp = [ lazydev-nvim ];                mini = [                  mini-ai diff --git a/lua/config/plugins/completion.lua b/lua/config/plugins/completion.lua index 7a02809..84b17dd 100644 --- a/lua/config/plugins/completion.lua +++ b/lua/config/plugins/completion.lua @@ -1,5 +1,31 @@  return {  	{ +		"lazydev.nvim", +		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(_) @@ -18,7 +44,16 @@ return {  					ghost_text = { enabled = true },  				}, -				sources = { default = { "lsp", "path", "snippets", "buffer" } }, +				sources = { +					default = { "lazydev", "lsp", "path", "snippets", "buffer" }, +					providers = { +						lazydev = { +							name = "LazyDev", +							module = "lazydev.integrations.blink", +							score_offset = 100, +						}, +					}, +				},  				fuzzy = {  					sorts = { "exact", "score", "sort_text" }, | 
