summaryrefslogtreecommitdiff
path: root/lspconfig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lspconfig.lua')
-rw-r--r--lspconfig.lua37
1 files changed, 26 insertions, 11 deletions
diff --git a/lspconfig.lua b/lspconfig.lua
index 1184af8..9827b2d 100644
--- a/lspconfig.lua
+++ b/lspconfig.lua
@@ -1,12 +1,19 @@
return {
"neovim/nvim-lspconfig",
- dependencies = { "williamboman/mason.nvim" },
+ dependencies = {
+ "williamboman/mason.nvim",
+ "williamboman/mason-lspconfig.nvim",
+ },
config = function()
- -- Define the configuration for pyright using the native API
+ -- Mason
+ require("mason").setup()
+
+ require("mason-lspconfig").setup({
+ ensure_installed = { "pyright", "clangd" },
+ })
+
+ -- Pyright
vim.lsp.config("pyright", {
- cmd = { "pyright-langserver", "--stdio" },
- filetypes = { "python" },
- root_markers = { "pyproject.toml", "setup.py", "requirements.txt", ".git" },
settings = {
python = {
analysis = {
@@ -17,12 +24,20 @@ return {
},
})
- -- Trigger the server start for python files
- vim.api.nvim_create_autocmd("FileType", {
- pattern = "python",
- callback = function(args)
- vim.lsp.start("pyright")
- end,
+ -- Clangd
+ vim.lsp.config("clangd", {
+ cmd = {
+ "clangd",
+ "--background-index",
+ "--clang-tidy",
+ "--header-insertion=never",
+ "--completion-style=detailed",
+ "--function-arg-placeholders",
+ },
})
+
+ -- Enable servers
+ vim.lsp.enable("pyright")
+ vim.lsp.enable("clangd")
end,
}