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.indentline")
|
||||
require("user.alpha")
|
||||
require("user.lsp")
|
||||
require("user.mason")
|
||||
require("user.dap")
|
||||
require("user.vimwiki")
|
||||
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")
|
||||
if not dap_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dap_ui_status_ok, dapui = pcall(require, "dapui")
|
||||
if not dap_ui_status_ok then
|
||||
return
|
||||
end
|
||||
-- local dap_ui_status_ok, dapui = pcall(require, "dapui")
|
||||
-- if not dap_ui_status_ok then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
|
||||
if not dap_install_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
mason_dap.setup({
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
})
|
||||
dap_install.setup({})
|
||||
|
||||
dap_install.config("python", {})
|
||||
-- add other configs here
|
||||
|
||||
dapui.setup({
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
"scopes",
|
||||
"breakpoints",
|
||||
"stacs",
|
||||
"watches",
|
||||
},
|
||||
size = 40,
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 10,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
|
||||
-- sidebar = {
|
||||
-- elements = {
|
||||
-- {
|
||||
-- id = "scopes",
|
||||
-- size = 0.25, -- Can be float or integer > 1
|
||||
-- },
|
||||
-- { id = "breakpoints", size = 0.25 },
|
||||
-- },
|
||||
-- size = 40,
|
||||
-- position = "right", -- Can be "left", "right", "top", "bottom"
|
||||
-- },
|
||||
-- tray = {
|
||||
-- elements = {},
|
||||
-- },
|
||||
})
|
||||
-- dapui.setup({
|
||||
-- layouts = {
|
||||
-- {
|
||||
-- elements = {
|
||||
-- "scopes",
|
||||
-- "breakpoints",
|
||||
-- "stacs",
|
||||
-- "watches",
|
||||
-- },
|
||||
-- size = 40,
|
||||
-- position = "left",
|
||||
-- },
|
||||
-- {
|
||||
-- elements = {
|
||||
-- "repl",
|
||||
-- "console",
|
||||
-- },
|
||||
-- size = 10,
|
||||
-- position = "bottom",
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- -- sidebar = {
|
||||
-- -- elements = {
|
||||
-- -- {
|
||||
-- -- id = "scopes",
|
||||
-- -- size = 0.25, -- Can be float or integer > 1
|
||||
-- -- },
|
||||
-- -- { id = "breakpoints", size = 0.25 },
|
||||
-- -- },
|
||||
-- -- size = 40,
|
||||
-- -- position = "right", -- Can be "left", "right", "top", "bottom"
|
||||
-- -- },
|
||||
-- -- tray = {
|
||||
-- -- elements = {},
|
||||
-- -- },
|
||||
-- })
|
||||
|
||||
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
|
||||
return
|
||||
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 = {
|
||||
"bashls",
|
||||
"cssls",
|
||||
@ -20,38 +44,55 @@ local servers = {
|
||||
"yamlls",
|
||||
}
|
||||
|
||||
lsp_installer.setup()
|
||||
|
||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status_ok then
|
||||
return
|
||||
end
|
||||
mason_tool.setup({
|
||||
ensure_installed = {
|
||||
"bash-language-server",
|
||||
"clangd",
|
||||
"css-lsp",
|
||||
"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 = {}
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
opts = {
|
||||
on_attach = require("user.lsp.handlers").on_attach,
|
||||
capabilities = require("user.lsp.handlers").capabilities,
|
||||
on_attach = require("user.mason.handlers").on_attach,
|
||||
capabilities = require("user.mason.handlers").capabilities,
|
||||
}
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
-- 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)
|
||||
-- end
|
||||
--
|
||||
-- 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)
|
||||
-- end
|
||||
|
||||
@ -87,8 +128,8 @@ for _, server in pairs(servers) do
|
||||
end,
|
||||
},
|
||||
server = {
|
||||
on_attach = require("user.lsp.handlers").on_attach,
|
||||
capabilities = require("user.lsp.handlers").capabilities,
|
||||
on_attach = require("user.mason.handlers").on_attach,
|
||||
capabilities = require("user.mason.handlers").capabilities,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
lens = {
|
||||
@ -144,24 +185,24 @@ for _, server in pairs(servers) do
|
||||
priority = 100,
|
||||
},
|
||||
ast = {
|
||||
-- These are unicode, should be available in any font
|
||||
role_icons = {
|
||||
type = "🄣",
|
||||
declaration = "🄓",
|
||||
expression = "🄔",
|
||||
statement = ";",
|
||||
specifier = "🄢",
|
||||
["template argument"] = "🆃",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "🄲",
|
||||
Recovery = "🅁",
|
||||
TranslationUnit = "🅄",
|
||||
PackExpansion = "🄿",
|
||||
TemplateTypeParm = "🅃",
|
||||
TemplateTemplateParm = "🅃",
|
||||
TemplateParamObject = "🅃",
|
||||
},
|
||||
-- -- These are unicode, should be available in any font
|
||||
-- role_icons = {
|
||||
-- type = "🄣",
|
||||
-- declaration = "🄓",
|
||||
-- expression = "🄔",
|
||||
-- statement = ";",
|
||||
-- specifier = "🄢",
|
||||
-- ["template argument"] = "🆃",
|
||||
-- },
|
||||
-- kind_icons = {
|
||||
-- Compound = "🄲",
|
||||
-- Recovery = "🅁",
|
||||
-- TranslationUnit = "🅄",
|
||||
-- PackExpansion = "🄿",
|
||||
-- TemplateTypeParm = "🅃",
|
||||
-- TemplateTemplateParm = "🅃",
|
||||
-- TemplateParamObject = "🅃",
|
||||
-- },
|
||||
-- These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
@ -3,6 +3,11 @@ if not null_ls_status_ok then
|
||||
return
|
||||
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
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- 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.stylua,
|
||||
formatting.rustfmt,
|
||||
formatting.beautysh,
|
||||
formatting.djhtml,
|
||||
formatting.djlint,
|
||||
formatting.tidy,
|
||||
formatting.stylelint,
|
||||
diagnostics.cpplint,
|
||||
diagnostics.luacheck,
|
||||
-- diagnostics.flake8,
|
||||
diagnostics.pylint,
|
||||
-- diagnostics.mypy,
|
||||
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 = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off",
|
||||
typeCheckingMode = "true",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -77,16 +77,20 @@ return packer.startup(function(use)
|
||||
use("hrsh7th/cmp-path") -- path completions
|
||||
use("saadparwaiz1/cmp_luasnip") -- snippet completions
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("hrsh7th/cmp-nvim-lua")
|
||||
|
||||
-- snippets
|
||||
use("L3MON4D3/LuaSnip") --snippet engine
|
||||
use("rafamadriz/friendly-snippets") -- a bunch of snippets to use
|
||||
|
||||
-- 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("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("jayp0521/mason-null-ls.nvim")
|
||||
use("RubixDev/mason-update-all")
|
||||
use("RRethy/vim-illuminate")
|
||||
use({ "Saecki/crates.nvim", tag = "v0.3.0" })
|
||||
use("simrat39/rust-tools.nvim")
|
||||
@ -108,6 +112,7 @@ return packer.startup(function(use)
|
||||
-- DAP
|
||||
use("mfussenegger/nvim-dap")
|
||||
use("rcarriga/nvim-dap-ui")
|
||||
use("jayp0521/mason-nvim-dap.nvim")
|
||||
use("ravenxrz/DAPInstall.nvim")
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
|
||||
@ -175,11 +175,11 @@ local mappings = {
|
||||
i = { "<cmd>LspInfo<cr>", "Info" },
|
||||
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
|
||||
j = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_next()<cr>",
|
||||
"<cmd>lua vim.diagnostic.goto_next()<cr>",
|
||||
"Next Diagnostic",
|
||||
},
|
||||
k = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>",
|
||||
"<cmd>lua vim.diagnostic.goto_prev()<cr>",
|
||||
"Prev Diagnostic",
|
||||
},
|
||||
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user