Merge branch 'dev' into thesis

nvim: fix lsp installation dir variable
        fix lspconfig require formatting
        format lsp server list
        add rust_analyzer LSP
This commit is contained in:
David JULIEN 2022-12-02 16:20:25 +01:00
commit 6547dfe599
No known key found for this signature in database
GPG Key ID: 1DD6B2BA6DD78810
3 changed files with 26 additions and 4 deletions

View File

@ -6,8 +6,7 @@
local M = {} local M = {}
local lsp_root_path = vim.fn.stdpath("data") .. "/lsp_servers/" local clangd_binary = _G.lsp_root_dir .. "clangd/clangd/bin/clangd"
local clangd_binary = lsp_root_path .. "clangd/clangd/bin/clangd"
M.setup = function(opts) M.setup = function(opts)
opts.settings = { opts.settings = {

View File

@ -58,7 +58,12 @@ end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
local servers = { "clangd", "sumneko_lua", "texlab" } local servers = {
"clangd",
"rust_analyzer",
"sumneko_lua",
"texlab",
}
mason.setup({ mason.setup({
ui = { ui = {
@ -70,6 +75,8 @@ mason.setup({
} }
}) })
_G.lsp_root_dir = vim.fn.stdpath("data") .. "/mason/bin"
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = servers, ensure_installed = servers,
}) })
@ -81,7 +88,7 @@ for _, server in ipairs(servers) do
capabilities = capabilities, capabilities = capabilities,
} }
local plugin = string.format("%s.%s", "plugin.lsp", server) local plugin = string.format("plugin.lsp.%s", server)
require(plugin).setup(opts) require(plugin).setup(opts)
lspconfig[server].setup(opts) lspconfig[server].setup(opts)

View File

@ -0,0 +1,16 @@
-- Author : swytch
-- Created : Wednesday Nov. 30, 2022 16:35:43 CET
-- License : GPLv3
-- Description : neovim lsp config file for rust_analyzer
local M = {}
local rust_analayzer_binary = _G.lsp_root_dir .. "rust_analyzer/rust_analyzer"
M.setup = function(opts)
opts.settings = {}
end
return M