154 lines
3.5 KiB
Lua
154 lines
3.5 KiB
Lua
return {
|
|
-- Mason (LSP server installer)
|
|
{
|
|
"mason-org/mason.nvim",
|
|
config = function()
|
|
require("mason").setup()
|
|
end,
|
|
},
|
|
|
|
-- Mason Tool Installer (auto-install formatters and linters)
|
|
{
|
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
dependencies = { "mason-org/mason.nvim" },
|
|
config = function()
|
|
require("mason-tool-installer").setup({
|
|
ensure_installed = {
|
|
-- Formatters
|
|
"prettier",
|
|
"black",
|
|
"stylua",
|
|
"shfmt",
|
|
-- Linters
|
|
"eslint_d",
|
|
"ruff",
|
|
"selene",
|
|
"shellcheck",
|
|
"jsonlint",
|
|
"yamllint",
|
|
"markdownlint",
|
|
},
|
|
auto_update = false,
|
|
run_on_start = true,
|
|
})
|
|
end,
|
|
},
|
|
|
|
-- Mason-LSPconfig (bridge Mason and nvim-lspconfig)
|
|
{
|
|
"mason-org/mason-lspconfig.nvim",
|
|
config = function()
|
|
require("mason-lspconfig").setup({
|
|
ensure_installed = {
|
|
"pyright", -- Python
|
|
"ts_ls", -- TypeScript/JavaScript
|
|
"vuels", -- Vue (Volar)
|
|
"jsonls", -- JSON
|
|
"yamlls", -- YAML
|
|
"html", -- HTML
|
|
"cssls", -- CSS
|
|
"bashls", -- Bash
|
|
"lua_ls", -- Lua
|
|
--"stylua",
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
|
|
-- nvim-lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
config = function()
|
|
local function get_venv_python()
|
|
local cwd = vim.fn.getcwd()
|
|
local handles = vim.fn.glob(cwd .. "/.venv*", true, true)
|
|
for _, v in ipairs(handles) do
|
|
if vim.fn.isdirectory(v) == 1 then
|
|
return v .. "/bin/python"
|
|
end
|
|
end
|
|
return vim.fn.exepath("python3") or "python3"
|
|
end
|
|
|
|
-- Lua
|
|
vim.lsp.config("lua_ls", {
|
|
settings = {
|
|
Lua = {
|
|
runtime = { version = "LuaJIT" },
|
|
diagnostics = { globals = { "vim" } },
|
|
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
|
|
},
|
|
},
|
|
})
|
|
|
|
-- Python
|
|
vim.lsp.config("pyright", {
|
|
settings = {
|
|
python = {
|
|
pythonPath = get_venv_python(),
|
|
analysis = {
|
|
typeCheckingMode = "basic",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
-- Type- and JavaScript
|
|
vim.lsp.config("ts_ls", {
|
|
settings = {
|
|
typescript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = "all",
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
javascript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = "all",
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
-- Vue
|
|
vim.lsp.config("vuels", {
|
|
filetypes = { "vue" },
|
|
init_options = {
|
|
typescript = {
|
|
tsdk = vim.fn.getcwd() .. "/node_modules/typescript/lib",
|
|
},
|
|
},
|
|
})
|
|
|
|
-- Other languages
|
|
vim.lsp.config("jsonls", {})
|
|
vim.lsp.config("yamlls", {})
|
|
vim.lsp.config("html", {})
|
|
vim.lsp.config("cssls", {})
|
|
vim.lsp.config("bashls", {})
|
|
|
|
-- Enable servers
|
|
vim.lsp.enable("lua_ls")
|
|
vim.lsp.enable("pyright")
|
|
vim.lsp.enable("ts_ls")
|
|
vim.lsp.enable("vuels")
|
|
vim.lsp.enable("jsonls")
|
|
vim.lsp.enable("yamlls")
|
|
vim.lsp.enable("html")
|
|
vim.lsp.enable("cssls")
|
|
vim.lsp.enable("bashls")
|
|
end,
|
|
},
|
|
}
|