2025-01-16 12:23:15 -06:00
|
|
|
return {
|
2026-02-17 17:16:01 -06:00
|
|
|
{
|
|
|
|
|
"williamboman/mason.nvim",
|
|
|
|
|
lazy = false,
|
|
|
|
|
config = function()
|
|
|
|
|
require("mason").setup()
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"williamboman/mason-lspconfig.nvim",
|
|
|
|
|
lazy = false,
|
|
|
|
|
opts = {
|
|
|
|
|
automatic_enable = false,
|
|
|
|
|
auto_install = true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"linux-cultist/venv-selector.nvim",
|
|
|
|
|
dependencies = {
|
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
|
"mfussenegger/nvim-dap",
|
|
|
|
|
"mfussenegger/nvim-dap-python",
|
|
|
|
|
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
|
|
|
|
},
|
|
|
|
|
ft = "python",
|
|
|
|
|
keys = {
|
|
|
|
|
{ "<leader>v", "<cmd>VenvSelect<cr>" },
|
|
|
|
|
},
|
|
|
|
|
opts = {
|
|
|
|
|
search = {},
|
|
|
|
|
options = {},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"b0o/SchemaStore.nvim",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
|
dependencies = { "hoffs/omnisharp-extended-lsp.nvim" },
|
|
|
|
|
lazy = false,
|
|
|
|
|
config = function()
|
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
2025-01-16 12:23:15 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
|
|
|
|
|
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
2025-03-31 20:47:35 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local lvl = ({
|
|
|
|
|
ERROR = vim.log.levels.ERROR,
|
|
|
|
|
WARNING = vim.log.levels.WARN,
|
|
|
|
|
INFO = vim.log.levels.INFO,
|
|
|
|
|
LOG = vim.log.levels.DEBUG,
|
|
|
|
|
})[result.type]
|
2025-03-31 20:47:35 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.notify(result.message, lvl, {
|
|
|
|
|
title = string.format("LSP[%s]", client and client.name or "Unknown"),
|
|
|
|
|
})
|
|
|
|
|
end
|
2025-03-31 20:47:35 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
|
|
|
|
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
2025-03-31 20:47:35 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
if result.value.kind == "begin" then
|
|
|
|
|
vim.notify(
|
|
|
|
|
string.format("LSP[%s] %s", client and client.name or "Unknown", result.value.title),
|
|
|
|
|
vim.log.levels.INFO
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-03-31 20:47:35 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local base_on_attach = vim.lsp.config.eslint.on_attach
|
2025-01-17 12:32:12 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("eslint", {
|
|
|
|
|
on_attach = function(client, bufnr)
|
|
|
|
|
if not base_on_attach then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-06-01 23:57:25 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
base_on_attach(client, bufnr)
|
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
|
|
|
buffer = bufnr,
|
|
|
|
|
command = "LspEslintFixAll",
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("eslint")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("omnisharp", {
|
|
|
|
|
handlers = {
|
|
|
|
|
["textDocument/definition"] = require("omnisharp_extended").handler,
|
|
|
|
|
},
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("omnisharp")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-03-25 05:50:13 -05:00
|
|
|
vim.lsp.config("fsautocomplete", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.lsp.enable("fsautocomplete")
|
|
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("lua_ls", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("lua_ls")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local vue_language_server_path = vim.fn.stdpath("data")
|
|
|
|
|
.. "/mason/packages/vue-language-server/node_modules/@vue/language-server"
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local tsserver_filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local vue_plugin = {
|
|
|
|
|
name = "@vue/typescript-plugin",
|
|
|
|
|
location = vue_language_server_path,
|
|
|
|
|
languages = { "vue" },
|
|
|
|
|
configNamespace = "typescript",
|
|
|
|
|
}
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local ts_ls_config = {
|
|
|
|
|
init_options = {
|
|
|
|
|
plugins = {
|
|
|
|
|
vue_plugin,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filetypes = tsserver_filetypes,
|
|
|
|
|
}
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local vue_ls_config = {}
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("vue_ls", vue_ls_config)
|
|
|
|
|
vim.lsp.config("ts_ls", ts_ls_config)
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("vue_ls")
|
|
|
|
|
vim.lsp.enable("ts_ls")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("jsonls", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
settings = {
|
|
|
|
|
json = {
|
|
|
|
|
schemas = require("schemastore").json.schemas(),
|
|
|
|
|
validate = { enable = true },
|
|
|
|
|
format = { enable = true },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("jsonls")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("html", {
|
|
|
|
|
filetypes = { "html", "ejs", "gohtml" },
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("html")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("emmet_language_server", {
|
|
|
|
|
filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "gohtml" },
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("emmet_language_server")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("cssls", {
|
|
|
|
|
filetypes = { "css", "scss", "less" },
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("cssls")
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("tailwindcss", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-11-16 05:42:39 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("tailwindcss")
|
2025-11-16 05:42:39 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("pyright", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-01-18 11:01:12 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("pyright")
|
2025-01-18 11:01:12 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("lemminx", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-01-18 11:01:12 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("lemminx")
|
2025-03-08 18:42:12 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("gopls", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml" },
|
2026-04-11 14:47:56 -05:00
|
|
|
settings = {
|
|
|
|
|
gopls = {
|
|
|
|
|
buildFlags = { "-tags=integration" }
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-17 17:16:01 -06:00
|
|
|
})
|
2025-03-15 17:37:50 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("gopls")
|
2025-01-20 23:27:51 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.config("rust_analyzer", {
|
|
|
|
|
settings = {
|
|
|
|
|
["rust-analyzer"] = {
|
2026-02-18 04:40:21 -06:00
|
|
|
files = {
|
|
|
|
|
watcher = "server",
|
|
|
|
|
},
|
|
|
|
|
check = {
|
|
|
|
|
command = "clippy",
|
|
|
|
|
},
|
2026-02-17 17:16:01 -06:00
|
|
|
diagnostics = {
|
|
|
|
|
enable = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("rust_analyzer")
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-03-25 05:50:13 -05:00
|
|
|
vim.lsp.config("gh_actions_ls", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
filetypes = { "yaml" },
|
|
|
|
|
settings = {
|
|
|
|
|
yaml = {
|
|
|
|
|
schemas = {
|
|
|
|
|
["https://json.schemastore.org/github-workflow.json"] = "/*/.github/workflows/*",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.lsp.enable("gh_actions_ls")
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-03-25 05:50:13 -05:00
|
|
|
vim.lsp.config("sqlls", {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
filetypes = { "sql" },
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.lsp.enable("sqlls")
|
|
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
|
|
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
|
|
|
callback = function(ev)
|
|
|
|
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
if not client then
|
|
|
|
|
vim.notify("LSP client not found", vim.log.levels.ERROR)
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
if not client.server_capabilities then
|
|
|
|
|
vim.notify("LSP server not ready yet", vim.log.levels.WARN)
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
client.on_error = function(err)
|
|
|
|
|
vim.notify(string.format("LSP server error: %s", err.message), vim.log.levels.ERROR)
|
|
|
|
|
end
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
client.on_status = function(status)
|
|
|
|
|
if status == "stopped" then
|
|
|
|
|
vim.notify("LSP server stopped", vim.log.levels.WARN)
|
|
|
|
|
elseif status == "running" then
|
|
|
|
|
vim.notify("LSP server running", vim.log.levels.INFO)
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
local omnisharp = require("omnisharp_extended")
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
if client.name == "omnisharp" then
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gd",
|
|
|
|
|
omnisharp.telescope_lsp_definition,
|
|
|
|
|
{ desc = "Go to definition", buffer = ev.buf }
|
|
|
|
|
)
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gi",
|
|
|
|
|
omnisharp.telescope_lsp_implementation,
|
|
|
|
|
{ desc = "Go to implementation", buffer = ev.buf }
|
|
|
|
|
)
|
2025-09-30 12:23:53 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gr",
|
|
|
|
|
omnisharp.telescope_lsp_references,
|
|
|
|
|
{ desc = "Go to references", buffer = ev.buf }
|
|
|
|
|
)
|
2025-10-01 12:25:29 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>D",
|
|
|
|
|
omnisharp.telescope_lsp_type_definition,
|
|
|
|
|
{ desc = "Go to type definition", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gd",
|
|
|
|
|
vim.lsp.buf.definition,
|
|
|
|
|
{ desc = "Go to definition", buffer = ev.buf }
|
|
|
|
|
)
|
2025-10-01 12:25:29 -05:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gD",
|
|
|
|
|
vim.lsp.buf.declaration,
|
|
|
|
|
{ desc = "Go to declaration", buffer = ev.buf }
|
|
|
|
|
)
|
2025-12-13 06:38:03 -06:00
|
|
|
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gi",
|
|
|
|
|
vim.lsp.buf.implementation,
|
|
|
|
|
{ desc = "Go to implementation", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"gr",
|
|
|
|
|
vim.lsp.buf.references,
|
|
|
|
|
{ desc = "Go to references", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
|
|
|
|
callback = function()
|
2026-05-20 11:31:49 -05:00
|
|
|
local parsers = require("nvim-treesitter.parsers")
|
|
|
|
|
|
|
|
|
|
if parsers then
|
2026-02-17 17:16:01 -06:00
|
|
|
vim.opt.foldmethod = "expr"
|
|
|
|
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
|
|
|
else
|
|
|
|
|
vim.opt.foldmethod = "syntax"
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
|
|
|
pattern = "*.go",
|
|
|
|
|
callback = function()
|
|
|
|
|
local params = vim.lsp.util.make_range_params()
|
|
|
|
|
params.context = { only = { "source.organizeImports" } }
|
|
|
|
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
|
|
|
|
for cid, res in pairs(result or {}) do
|
|
|
|
|
for _, r in pairs(res.result or {}) do
|
|
|
|
|
if r.edit then
|
|
|
|
|
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
|
|
|
|
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
vim.lsp.buf.format({ async = false })
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>ca",
|
|
|
|
|
vim.lsp.buf.code_action,
|
|
|
|
|
{ desc = "Code actions", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename", buffer = ev.buf })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>e",
|
|
|
|
|
vim.diagnostic.open_float,
|
|
|
|
|
{ desc = "Display error for current line", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>ea",
|
|
|
|
|
":Telescope diagnostics bufnr=0<CR>",
|
|
|
|
|
{ desc = "Display errors for current buffer", buffer = ev.buf }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Display symbol info", buffer = ev.buf })
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
},
|
2025-01-16 12:23:15 -06:00
|
|
|
}
|