mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2025-10-21 20:10:41 +00:00
Moved from LSP to Mason
This commit is contained in:
parent
7cf129370e
commit
dca22b880b
2
init.lua
2
init.lua
@ -18,7 +18,7 @@ require("user.impatient")
|
|||||||
require("user.illuminate")
|
require("user.illuminate")
|
||||||
require("user.indentline")
|
require("user.indentline")
|
||||||
require("user.alpha")
|
require("user.alpha")
|
||||||
require("user.lsp")
|
require("user.mason")
|
||||||
require("user.dap")
|
require("user.dap")
|
||||||
require("user.vimwiki")
|
require("user.vimwiki")
|
||||||
require("user.whichkey")
|
require("user.whichkey")
|
||||||
|
|||||||
@ -1,60 +1,69 @@
|
|||||||
|
local status_mason_dap_ok, mason_dap = pcall(require, "mason-nvim-dap")
|
||||||
|
if not status_mason_dap_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local dap_status_ok, dap = pcall(require, "dap")
|
local dap_status_ok, dap = pcall(require, "dap")
|
||||||
if not dap_status_ok then
|
if not dap_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local dap_ui_status_ok, dapui = pcall(require, "dapui")
|
-- local dap_ui_status_ok, dapui = pcall(require, "dapui")
|
||||||
if not dap_ui_status_ok then
|
-- if not dap_ui_status_ok then
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
|
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
|
||||||
if not dap_install_status_ok then
|
if not dap_install_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mason_dap.setup({
|
||||||
|
automatic_installation = true,
|
||||||
|
automatic_setup = true,
|
||||||
|
})
|
||||||
dap_install.setup({})
|
dap_install.setup({})
|
||||||
|
|
||||||
dap_install.config("python", {})
|
dap_install.config("python", {})
|
||||||
-- add other configs here
|
-- add other configs here
|
||||||
|
|
||||||
dapui.setup({
|
-- dapui.setup({
|
||||||
layouts = {
|
-- layouts = {
|
||||||
{
|
-- {
|
||||||
elements = {
|
-- elements = {
|
||||||
"scopes",
|
-- "scopes",
|
||||||
"breakpoints",
|
-- "breakpoints",
|
||||||
"stacs",
|
-- "stacs",
|
||||||
"watches",
|
-- "watches",
|
||||||
},
|
-- },
|
||||||
size = 40,
|
-- size = 40,
|
||||||
position = "left",
|
-- position = "left",
|
||||||
},
|
-- },
|
||||||
{
|
-- {
|
||||||
elements = {
|
-- elements = {
|
||||||
"repl",
|
-- "repl",
|
||||||
"console",
|
-- "console",
|
||||||
},
|
-- },
|
||||||
size = 10,
|
-- size = 10,
|
||||||
position = "bottom",
|
-- position = "bottom",
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
|
--
|
||||||
-- sidebar = {
|
-- -- sidebar = {
|
||||||
-- elements = {
|
-- -- elements = {
|
||||||
-- {
|
-- -- {
|
||||||
-- id = "scopes",
|
-- -- id = "scopes",
|
||||||
-- size = 0.25, -- Can be float or integer > 1
|
-- -- size = 0.25, -- Can be float or integer > 1
|
||||||
-- },
|
-- -- },
|
||||||
-- { id = "breakpoints", size = 0.25 },
|
-- -- { id = "breakpoints", size = 0.25 },
|
||||||
-- },
|
-- -- },
|
||||||
-- size = 40,
|
-- -- size = 40,
|
||||||
-- position = "right", -- Can be "left", "right", "top", "bottom"
|
-- -- position = "right", -- Can be "left", "right", "top", "bottom"
|
||||||
-- },
|
-- -- },
|
||||||
-- tray = {
|
-- -- tray = {
|
||||||
-- elements = {},
|
-- -- elements = {},
|
||||||
-- },
|
-- -- },
|
||||||
})
|
-- })
|
||||||
|
|
||||||
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
|
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
local status_ok, _ = pcall(require, "lspconfig")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("user.lsp.lsp-installer")
|
|
||||||
require("user.lsp.handlers").setup()
|
|
||||||
require("user.lsp.null-ls")
|
|
||||||
8
lua/user/mason/init.lua
Normal file
8
lua/user/mason/init.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
local status_ok, _ = pcall(require, "mason-lspconfig")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("user.mason.mason-installer")
|
||||||
|
require("user.mason.handlers").setup()
|
||||||
|
require("user.mason.null-ls")
|
||||||
@ -1,8 +1,32 @@
|
|||||||
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
|
local status_ok, mason = pcall(require, "mason")
|
||||||
if not status_ok then
|
if not status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local status_mason_lspconfig_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||||
|
if not status_mason_lspconfig_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local status_lspconfig_ok, lspconfig = pcall(require, "lspconfig")
|
||||||
|
if not status_lspconfig_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local status_update_all_ok, mason_update_all = pcall(require, "mason-update-all")
|
||||||
|
if not status_update_all_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local status_tool_ok, mason_tool = pcall(require, "mason-tool-installer")
|
||||||
|
if not status_tool_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
mason.setup()
|
||||||
|
mason_lspconfig.setup()
|
||||||
|
mason_update_all.setup()
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"cssls",
|
"cssls",
|
||||||
@ -20,38 +44,55 @@ local servers = {
|
|||||||
"yamlls",
|
"yamlls",
|
||||||
}
|
}
|
||||||
|
|
||||||
lsp_installer.setup()
|
mason_tool.setup({
|
||||||
|
ensure_installed = {
|
||||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
"bash-language-server",
|
||||||
if not lspconfig_status_ok then
|
"clangd",
|
||||||
return
|
"css-lsp",
|
||||||
end
|
"diagnostic-languageserver",
|
||||||
|
"emmet-ls",
|
||||||
|
"html-lsp",
|
||||||
|
"json-lsp",
|
||||||
|
"lua-language-server",
|
||||||
|
"marksman",
|
||||||
|
"pyright",
|
||||||
|
"rust-analyzer",
|
||||||
|
"taplo",
|
||||||
|
"texlab",
|
||||||
|
-- "typescript-language-server",
|
||||||
|
"vim-language-server",
|
||||||
|
"yaml-language-server",
|
||||||
|
},
|
||||||
|
auto_update = true,
|
||||||
|
run_on_start = true,
|
||||||
|
start_delay = 0,
|
||||||
|
})
|
||||||
|
|
||||||
local opts = {}
|
local opts = {}
|
||||||
|
|
||||||
for _, server in pairs(servers) do
|
for _, server in pairs(servers) do
|
||||||
opts = {
|
opts = {
|
||||||
on_attach = require("user.lsp.handlers").on_attach,
|
on_attach = require("user.mason.handlers").on_attach,
|
||||||
capabilities = require("user.lsp.handlers").capabilities,
|
capabilities = require("user.mason.handlers").capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
if server == "sumneko_lua" then
|
if server == "sumneko_lua" then
|
||||||
local sumneko_opts = require("user.lsp.settings.sumneko_lua")
|
local sumneko_opts = require("user.mason.settings.sumneko_lua")
|
||||||
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
|
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
if server == "pyright" then
|
if server == "pyright" then
|
||||||
local pyright_opts = require("user.lsp.settings.pyright")
|
local pyright_opts = require("user.mason.settings.pyright")
|
||||||
opts = vim.tbl_deep_extend("force", pyright_opts, opts)
|
opts = vim.tbl_deep_extend("force", pyright_opts, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if server == "clangd" then
|
-- if server == "clangd" then
|
||||||
-- local clangd_opts = require("user.lsp.settings.clangd")
|
-- local clangd_opts = require("user.mason.settings.clangd")
|
||||||
-- opts = vim.tbl_deep_extend("force", clangd_opts)
|
-- opts = vim.tbl_deep_extend("force", clangd_opts)
|
||||||
-- end
|
-- end
|
||||||
--
|
--
|
||||||
-- if server == "html" then
|
-- if server == "html" then
|
||||||
-- local html_opts = require("user.lsp.settings.html")
|
-- local html_opts = require("user.mason.settings.html")
|
||||||
-- opts = vim.tbl_deep_extend("force", html_opts)
|
-- opts = vim.tbl_deep_extend("force", html_opts)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
@ -87,8 +128,8 @@ for _, server in pairs(servers) do
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
server = {
|
server = {
|
||||||
on_attach = require("user.lsp.handlers").on_attach,
|
on_attach = require("user.mason.handlers").on_attach,
|
||||||
capabilities = require("user.lsp.handlers").capabilities,
|
capabilities = require("user.mason.handlers").capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = {
|
["rust-analyzer"] = {
|
||||||
lens = {
|
lens = {
|
||||||
@ -144,24 +185,24 @@ for _, server in pairs(servers) do
|
|||||||
priority = 100,
|
priority = 100,
|
||||||
},
|
},
|
||||||
ast = {
|
ast = {
|
||||||
-- These are unicode, should be available in any font
|
-- -- These are unicode, should be available in any font
|
||||||
role_icons = {
|
-- role_icons = {
|
||||||
type = "🄣",
|
-- type = "🄣",
|
||||||
declaration = "🄓",
|
-- declaration = "🄓",
|
||||||
expression = "🄔",
|
-- expression = "🄔",
|
||||||
statement = ";",
|
-- statement = ";",
|
||||||
specifier = "🄢",
|
-- specifier = "🄢",
|
||||||
["template argument"] = "🆃",
|
-- ["template argument"] = "🆃",
|
||||||
},
|
-- },
|
||||||
kind_icons = {
|
-- kind_icons = {
|
||||||
Compound = "🄲",
|
-- Compound = "🄲",
|
||||||
Recovery = "🅁",
|
-- Recovery = "🅁",
|
||||||
TranslationUnit = "🅄",
|
-- TranslationUnit = "🅄",
|
||||||
PackExpansion = "🄿",
|
-- PackExpansion = "🄿",
|
||||||
TemplateTypeParm = "🅃",
|
-- TemplateTypeParm = "🅃",
|
||||||
TemplateTemplateParm = "🅃",
|
-- TemplateTemplateParm = "🅃",
|
||||||
TemplateParamObject = "🅃",
|
-- TemplateParamObject = "🅃",
|
||||||
},
|
-- },
|
||||||
-- These require codicons (https://github.com/microsoft/vscode-codicons)
|
-- These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||||
role_icons = {
|
role_icons = {
|
||||||
type = "",
|
type = "",
|
||||||
@ -3,6 +3,11 @@ if not null_ls_status_ok then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mason_null_ls_status_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||||
|
if not mason_null_ls_status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||||
@ -18,14 +23,33 @@ null_ls.setup({
|
|||||||
}),
|
}),
|
||||||
formatting.autopep8,
|
formatting.autopep8,
|
||||||
formatting.stylua,
|
formatting.stylua,
|
||||||
formatting.rustfmt,
|
|
||||||
formatting.beautysh,
|
formatting.beautysh,
|
||||||
formatting.djhtml,
|
formatting.djlint,
|
||||||
formatting.tidy,
|
formatting.tidy,
|
||||||
formatting.stylelint,
|
diagnostics.cpplint,
|
||||||
diagnostics.luacheck,
|
diagnostics.luacheck,
|
||||||
-- diagnostics.flake8,
|
|
||||||
diagnostics.pylint,
|
diagnostics.pylint,
|
||||||
|
-- diagnostics.mypy,
|
||||||
diagnostics.zsh,
|
diagnostics.zsh,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mason_null_ls.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"autopep8",
|
||||||
|
"beautysh",
|
||||||
|
"djlint",
|
||||||
|
"shfmt",
|
||||||
|
"yamlfmt",
|
||||||
|
"codespell",
|
||||||
|
"cpplint",
|
||||||
|
"luacheck",
|
||||||
|
"misspell",
|
||||||
|
"pylint",
|
||||||
|
"mypy",
|
||||||
|
"html_lint",
|
||||||
|
"gitlint",
|
||||||
|
},
|
||||||
|
automatic_installation = true,
|
||||||
|
automatic_setup = true,
|
||||||
|
})
|
||||||
@ -2,7 +2,7 @@ return {
|
|||||||
settings = {
|
settings = {
|
||||||
python = {
|
python = {
|
||||||
analysis = {
|
analysis = {
|
||||||
typeCheckingMode = "off",
|
typeCheckingMode = "true",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -77,16 +77,20 @@ return packer.startup(function(use)
|
|||||||
use("hrsh7th/cmp-path") -- path completions
|
use("hrsh7th/cmp-path") -- path completions
|
||||||
use("saadparwaiz1/cmp_luasnip") -- snippet completions
|
use("saadparwaiz1/cmp_luasnip") -- snippet completions
|
||||||
use("hrsh7th/cmp-nvim-lsp")
|
use("hrsh7th/cmp-nvim-lsp")
|
||||||
use("hrsh7th/cmp-nvim-lua")
|
|
||||||
|
|
||||||
-- snippets
|
-- snippets
|
||||||
use("L3MON4D3/LuaSnip") --snippet engine
|
use("L3MON4D3/LuaSnip") --snippet engine
|
||||||
use("rafamadriz/friendly-snippets") -- a bunch of snippets to use
|
use("rafamadriz/friendly-snippets") -- a bunch of snippets to use
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
|
-- use("williamboman/nvim-lsp-installer") -- simple to use language server installer
|
||||||
|
use("williamboman/mason.nvim")
|
||||||
|
use("williamboman/mason-lspconfig.nvim")
|
||||||
use("neovim/nvim-lspconfig") -- enable LSP
|
use("neovim/nvim-lspconfig") -- enable LSP
|
||||||
use("williamboman/nvim-lsp-installer") -- simple to use language server installer
|
use("WhoIsSethDaniel/mason-tool-installer.nvim")
|
||||||
use("jose-elias-alvarez/null-ls.nvim") -- for formatters and linters
|
use("jose-elias-alvarez/null-ls.nvim") -- for formatters and linters
|
||||||
|
use("jayp0521/mason-null-ls.nvim")
|
||||||
|
use("RubixDev/mason-update-all")
|
||||||
use("RRethy/vim-illuminate")
|
use("RRethy/vim-illuminate")
|
||||||
use({ "Saecki/crates.nvim", tag = "v0.3.0" })
|
use({ "Saecki/crates.nvim", tag = "v0.3.0" })
|
||||||
use("simrat39/rust-tools.nvim")
|
use("simrat39/rust-tools.nvim")
|
||||||
@ -108,6 +112,7 @@ return packer.startup(function(use)
|
|||||||
-- DAP
|
-- DAP
|
||||||
use("mfussenegger/nvim-dap")
|
use("mfussenegger/nvim-dap")
|
||||||
use("rcarriga/nvim-dap-ui")
|
use("rcarriga/nvim-dap-ui")
|
||||||
|
use("jayp0521/mason-nvim-dap.nvim")
|
||||||
use("ravenxrz/DAPInstall.nvim")
|
use("ravenxrz/DAPInstall.nvim")
|
||||||
|
|
||||||
-- Automatically set up your configuration after cloning packer.nvim
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
|||||||
@ -175,11 +175,11 @@ local mappings = {
|
|||||||
i = { "<cmd>LspInfo<cr>", "Info" },
|
i = { "<cmd>LspInfo<cr>", "Info" },
|
||||||
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
|
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
|
||||||
j = {
|
j = {
|
||||||
"<cmd>lua vim.lsp.diagnostic.goto_next()<cr>",
|
"<cmd>lua vim.diagnostic.goto_next()<cr>",
|
||||||
"Next Diagnostic",
|
"Next Diagnostic",
|
||||||
},
|
},
|
||||||
k = {
|
k = {
|
||||||
"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>",
|
"<cmd>lua vim.diagnostic.goto_prev()<cr>",
|
||||||
"Prev Diagnostic",
|
"Prev Diagnostic",
|
||||||
},
|
},
|
||||||
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
|
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user