From 9127a6161e465b7ca529d97109b60f2f05b8f561 Mon Sep 17 00:00:00 2001 From: Dario48 Date: Fri, 3 Apr 2026 15:33:09 +0200 Subject: [PATCH] fixed lsp and updated --- init.lua | 1 + lua/plugins/blink-cmp.lua | 58 +++++++++++++++++++++++++++++++++++++++ lua/plugins/lsp.lua | 44 +---------------------------- lua/utils/plugins.lua | 2 +- nvim-pack-lock.json | 8 ++++++ 5 files changed, 69 insertions(+), 44 deletions(-) create mode 100644 lua/plugins/blink-cmp.lua diff --git a/init.lua b/init.lua index a38dd17..f9f0769 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,7 @@ require("config.general") require("config.lsp") local plugins = { + "blink-cmp", "lsp", "mason-bridge", "mason", diff --git a/lua/plugins/blink-cmp.lua b/lua/plugins/blink-cmp.lua new file mode 100644 index 0000000..be1c8dc --- /dev/null +++ b/lua/plugins/blink-cmp.lua @@ -0,0 +1,58 @@ +---@module "utils.plugins" +---@type Plugin +return { + configures = "blink.cmp", + configure = function(load) + load("folke/lazydev.nvim") + require("lazydev").setup({}) + + load("rafamadriz/friendly-snippets") + load("saghen/blink.cmp") + + ---@module "blink.cmp" + require("blink.cmp").setup({ + keymap = { preset = "super-tab" }, + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + documentation = { auto_show = true }, + list = { + selection = { + preselect = true, + auto_insert = false, + }, + }, + }, + + signature = { enabled = true }, + + sources = { + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + score_offset = 100, + }, + }, + }, + + fuzzy = { implementation = "prefer_rust" }, + }) + end, + onUpdate = function() + vim.notify("Building blink.cmp", vim.log.levels.INFO) + local obj = vim.system({ "cargo", "build", "--release" }, { cwd = vim.pack.get({ "blink.cmp" })[1].path }) + :wait() + if obj.code == 0 then + vim.notify("Building blink.cmp done", vim.log.levels.INFO) + else + vim.notify("Building blink.cmp failed", vim.log.levels.ERROR) + end + end, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index bbe2c7a..8483601 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,52 +1,10 @@ ---@module "utils.plugins" ---@type Plugin return { - after = "mason", + after = { "mason", "blink.cmp" }, configure = function(load) load("neovim/nvim-lspconfig") - load("folke/lazydev.nvim") - require("lazydev").setup({}) - - --[[ - ---@type vim.lsp.Config - local config = { - ---@type lspconfig.settings.lua_ls - settings = { - Lua = { - runtime = { - version = "LuaJIT", - }, - workspace = { - preloadFileSize = 10000, - library = { - vim.env.VIMRUNTIME, - }, - }, - }, - }, - } - - vim.lsp.config("lua_ls", config) - ]] - -- - - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - if client and client:supports_method("textDocument/completion") then - vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true }) - end - end, - }) - vim.opt.completeopt = { "menuone", "noinsert", "popup" } - vim.keymap.set("i", "", function() - if vim.fn.pumvisible() == 1 then - return "" - end - return "" - end, { expr = true }) - -- Reserve a space in the gutter -- This will avoid an annoying layout shift in the screen vim.opt.signcolumn = "yes" diff --git a/lua/utils/plugins.lua b/lua/utils/plugins.lua index 06c379a..434eceb 100644 --- a/lua/utils/plugins.lua +++ b/lua/utils/plugins.lua @@ -106,7 +106,7 @@ function M.parse(plugin) end end else - if type(plugin.after == "string") then + if type(plugin.after) == "string" then if M.waiting[plugin.after] == nil then M.waiting[plugin.after] = {} end diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 9888bff..35ef6c8 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -4,6 +4,10 @@ "rev": "63462a1550878a5f1a89d5383279775e1882948e", "src": "https://github.com/0xferrous/ansi.nvim" }, + "blink.cmp": { + "rev": "5e088706d92da09949e081cc4d49e2c9ba8cfc8c", + "src": "https://github.com/saghen/blink.cmp" + }, "boo.nvim": { "rev": "926b2e92c7e4341ef5e64c7c8f3373768f5e9437", "src": "https://github.com/LukasPietzschmann/boo.nvim" @@ -24,6 +28,10 @@ "rev": "89d8110ec15021ac9a03ff2317d27b900c45bf60", "src": "https://github.com/3rd/diagram.nvim" }, + "friendly-snippets": { + "rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9", + "src": "https://github.com/rafamadriz/friendly-snippets" + }, "image.nvim": { "rev": "da2be65c153ba15a14a342b05591652a6df70d58", "src": "https://github.com/3rd/image.nvim"