1
0

Move some lsp configuration into functions

This commit is contained in:
Patrick Auernig 2024-05-06 23:18:42 +02:00
parent c581c9ff00
commit 60064aa16d

View File

@ -10,6 +10,41 @@ spec.dependencies = {
{ "folke/neoconf.nvim", tag = "v1.2.2" }, { "folke/neoconf.nvim", tag = "v1.2.2" },
} }
local function rust_analyzer_setup(lsp_config)
local rust_analyzer_settings = {
cargo = {
features = "all"
},
}
-- Don't have rustup available if using nix shell
if vim.fn.executable("rustup") == 1 then
rust_analyzer_settings = vim.tbl_extend("keep", rust_analyzer_settings, {
rustfmt = { extraArgs = { "+nightly" } }
})
end
lsp_config.rust_analyzer.setup({
settings = {
["rust-analyzer"] = rust_analyzer_settings
}
})
end
local function lua_ls_setup(lsp_config)
lsp_config.lua_ls.setup({
capabilities = {
textDocument = {
completion = {
completionItem = {
snippetSupport = false
}
}
}
}
})
end
spec.config = function() spec.config = function()
local neoconf = require("neoconf") local neoconf = require("neoconf")
@ -65,36 +100,9 @@ spec.config = function()
require("neodev").setup() require("neodev").setup()
lsp_config.lua_ls.setup({ lua_ls_setup(lsp_config)
capabilities = {
textDocument = {
completion = {
completionItem = {
snippetSupport = false
}
}
}
}
})
local rust_analyzer_settings = { rust_analyzer_setup(lsp_config)
cargo = {
features = "all"
},
}
-- Don't have rustup available if using nix shell
if vim.fn.executable("rustup") == 1 then
rust_analyzer_settings = vim.tbl_extend("keep", rust_analyzer_settings, {
rustfmt = { extraArgs = { "+nightly" } }
})
end
lsp_config.rust_analyzer.setup({
settings = {
["rust-analyzer"] = rust_analyzer_settings
}
})
lsp_config.sqlls.setup({}) lsp_config.sqlls.setup({})