Files
dotfiles/nvim/lua/plugins/lsp.lua
2025-08-24 22:33:05 -05:00

91 lines
2.7 KiB
Lua

return {
{
'saghen/blink.cmp',
-- optional: provides snippets for the snippet source
dependencies = { 'rafamadriz/friendly-snippets' },
-- use a release tag to download pre-built binaries
version = '1.*',
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- All presets have the following mappings:
-- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true)
--
-- See :h blink-cmp-config-keymap for defining your own keymap
keymap = { preset = 'super-tab' },
appearance = {
nerd_font_variant = 'mono'
},
completion = {
menu = {
-- min_width = 30,
-- max_width = 50,
-- max_height = 20,
border = 'rounded', -- Rounded corners for a fancy look
winblend = 10, -- Slight transparency for a modern look
winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None',
scrolloff = 2,
},
documentation = {
auto_show = true,
window = {
border = 'rounded',
winblend = 10,
winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None',
},
},
ghost_text = { enabled = true },
accept = { auto_brackets = { enabled = true } },
-- signature = {
-- enabled = true,
-- }
},
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
fuzzy = { implementation = "prefer_rust_with_warning" }
},
opts_extend = { "sources.default" }
},
{
'neovim/nvim-lspconfig',
dependencies = {
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
},
opts = {
servers = {
lua_ls = {},
clangd = {},
rust_analyzer = {},
yamlls = {},
gopls = {},
html = {}
}
},
config = function(_, opts)
local lspconfig = require('lspconfig')
for server, config in pairs(opts.servers) do
-- passing config.capabilities to blink.cmp merges with the capabilities in your
-- `opts[server].capabilities, if you've defined it
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config)
end
end
},
}