fixed lsp and updated

This commit is contained in:
Dario48 2026-04-03 15:33:09 +02:00
commit 9127a6161e
5 changed files with 69 additions and 44 deletions

58
lua/plugins/blink-cmp.lua Normal file
View file

@ -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,
}

View file

@ -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", "<Tab>", function()
if vim.fn.pumvisible() == 1 then
return "<C-y>"
end
return "<Tab>"
end, { expr = true })
-- Reserve a space in the gutter
-- This will avoid an annoying layout shift in the screen
vim.opt.signcolumn = "yes"