updated nvim config to 0.11 lsp

This commit is contained in:
Luka Jankovic 2025-11-04 00:09:54 +01:00
parent af6b443ef6
commit 04e711f146
5 changed files with 49 additions and 63 deletions

View file

@ -1,31 +1,12 @@
return {
{
"williamboman/mason.nvim",
cmd = "Mason",
},
{
"williamboman/mason-lspconfig.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("mason").setup()
if not vim.g.pre_load then
require("mason-lspconfig").setup({
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
-- function(server_name) -- default handler (optional)
-- require("lspconfig")[server_name].setup({})
-- end,
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
})
end
end,
},
{
"mason-org/mason-lspconfig.nvim",
opts = {},
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"neovim/nvim-lspconfig",
},
},
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
@ -47,25 +28,22 @@ return {
})
end,
},
{
"neovim/nvim-lspconfig",
},
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
opts = function()
local mason_reg = require("mason-registry")
local formatters = {}
local formatters_by_ft = {}
-- add diff langue vs filetype
local keymap = {
["c++"] = "cpp",
["c#"] = "cs",
}
-- add dif conform vs mason
local name_map = {
["cmakelang"] = "cmake_format",
@ -79,7 +57,7 @@ return {
["sql-formatter"] = "sql_formatter",
["xmlformatter"] = "xmlformat",
}
for _, pkg in pairs(mason_reg.get_installed_packages()) do
for _, type in pairs(pkg.spec.categories) do
-- only act upon a formatter
@ -94,7 +72,7 @@ return {
-- this should be replaced by a function
-- that quieries the configured mason install path
local prefix = vim.fn.stdpath("data") .. "/mason/bin/"
formatters[pkg.spec.name] = {
command = prefix .. bin,
args = { "$FILENAME" },
@ -102,7 +80,7 @@ return {
require_cwd = false,
}
end
-- finally add the formatter to it's compatible filetype(s)
for _, ft in pairs(pkg.spec.languages) do
local ftl = string.lower(ft)
@ -121,7 +99,7 @@ return {
end
end
end
return {
formatters = formatters,
formatters_by_ft = formatters_by_ft,