diff options
| author | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-24 03:53:10 +0100 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-24 03:53:10 +0100 |
| commit | 0703660d49f22376d52a969e8c3cca64480b0f1b (patch) | |
| tree | ef3986b3b49b07660b0dca8f1a5c7b7bea15f8b2 /lua/user/lsp | |
| parent | 2a5f8920d10c4a85586ae6d697f233ce52144a10 (diff) | |
mason-lspconfig & mason-null-ls
Diffstat (limited to 'lua/user/lsp')
| -rw-r--r-- | lua/user/lsp/init.lua | 7 | ||||
| -rw-r--r-- | lua/user/lsp/mason.lua | 36 |
2 files changed, 39 insertions, 4 deletions
diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua index 92ae9bf..202cccb 100644 --- a/lua/user/lsp/init.lua +++ b/lua/user/lsp/init.lua @@ -1,7 +1,8 @@ -local status_ok, _ = pcall(require, "lspconfig") -if not status_ok then +require "user.lsp.mason" + +local status, lspconfig = pcall(require, "lspconfig") +if not status then return end -require "user.lsp.mason" require "user.lsp.ccls" diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua index af77151..1b5717d 100644 --- a/lua/user/lsp/mason.lua +++ b/lua/user/lsp/mason.lua @@ -1,4 +1,10 @@ -require("mason").setup({ +local status, mason = pcall(require, "mason") +if not status then + return +end + +-- mason +mason.setup({ ui = { icons = { package_installed = "✓", @@ -7,3 +13,31 @@ require("mason").setup({ } } }) + +-- mason-lspconfig +require("mason-lspconfig").setup { + ensure_installed = { "pylsp", "bashls", "lua_ls", "cmake" }, +} +require("mason-lspconfig").setup_handlers { + function (server_name) + require("lspconfig")[server_name].setup {} + end +} + +-- mason-null-ls +require('mason-null-ls').setup({ + automatic_setup = true, + ensure_installed = { "cpplint" } +}) +require('mason-null-ls').setup_handlers { + function(source_name, methods) + require("mason-null-ls.automatic_setup")(source_name, methods) + end, +} + +-- null_ls +local status, null_ls = pcall(require, "null-ls") +if not status then + return +end +null_ls.setup() |
