mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
feat(dap.lua): add support for process.env.PORT environment variable to be able to run app on a configurable port feat(lsp-config.lua): add support for detecting python environment using DPE module feat(lualine.lua): add support for noice statusline component feat(mason.lua): update installed language servers list feat(noice.lua): add configuration for noice plugin feat(none-ls.lua): remove black and mypy formatters from null-ls setup fix(nvim-cmp.lua): change completeopt value to "menu,menuone,preview,noinsert" and add autocomplete trigger event on text change feat(nvim-cmp.lua): add border and winhighlight settings for documentation window to improve visual appearance feat(nvim-cmp.lua): add 'nvim_lsp_signature_help' as a source for autocompletion refactor(colorscheme.lua): refactor SetupWindowPreferences function to dynamically set blend values for highlight groups feat(init.lua): add setting for 'completeopt' to "menuone" feat(plugins/noice.lua): add configuration for 'noice.nvim' plugin with dependencies and event trigger feat(plugins/nvim-treesitter.lua): update configuration to run TSUpdate command silently feat(utils): add Lua utility functions to detect and manage Lua versions and paths feat(utils): add Python utility functions to check and resolve Python environments style(theme): update current theme to 'catppuccin' in Lua script
288 lines
7.3 KiB
Lua
288 lines
7.3 KiB
Lua
-- Setup language servers.
|
|
local lspconfig = require("lspconfig")
|
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
|
|
|
local DPE = require("absolute.utils.detect-python-env")
|
|
|
|
local opts = { noremap = true, silent = true }
|
|
local on_attach = function(client, bufnr)
|
|
opts.buffer = bufnr
|
|
|
|
-- Enable completion triggered by <c-x><c-o>
|
|
vim.bo[opts.buffer].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
|
|
opts.desc = "Go to declaration"
|
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
|
|
opts.desc = "Go to definitions"
|
|
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
|
|
|
opts.desc = "Show documentation for what is under cursor"
|
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
|
|
|
opts.desc = "Show LSP Implementation"
|
|
vim.keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
|
|
|
opts.desc = "Get Help"
|
|
vim.keymap.set("n", "<leader>gh", vim.lsp.buf.signature_help, opts)
|
|
|
|
-- vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
-- vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
-- vim.keymap.set('n', '<leader>wl', function()
|
|
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
-- end, opts)
|
|
|
|
opts.desc = "Show LSP type definitions"
|
|
vim.keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
|
|
|
opts.desc = "Smart rename"
|
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
|
|
|
opts.desc = "See available code actions"
|
|
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
|
|
|
opts.desc = "Show LSP references"
|
|
vim.keymap.set("n", "<leader>cr", "<cmd>Telescope lsp_references<CR>", opts)
|
|
|
|
opts.desc = "Format File"
|
|
vim.keymap.set("n", "<leader>f", function()
|
|
vim.lsp.buf.format({ async = true })
|
|
end, opts)
|
|
|
|
opts.desc = "Restart LSP"
|
|
vim.keymap.set("n", "<leader>rs", "<cmd>LspRestart<CR>", opts)
|
|
end
|
|
|
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
|
|
|
-- Change the Diagnostic symbols in the sign column (gutter)
|
|
local signs = {
|
|
Error = " ",
|
|
Warn = " ",
|
|
Hint = " ",
|
|
Info = " ",
|
|
}
|
|
|
|
for type, icon in pairs(signs) do
|
|
local hl = "DiagnosticSign" .. type
|
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
|
end
|
|
|
|
-- configure html server
|
|
lspconfig["html"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure typescript server with plugin
|
|
lspconfig["ts_ls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure css server
|
|
lspconfig["cssls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure tailwindcss server
|
|
lspconfig["tailwindcss"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure svelte server
|
|
lspconfig["svelte"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = function(client, bufnr)
|
|
on_attach(client, bufnr)
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
|
pattern = { "*.js", "*.ts" },
|
|
callback = function(ctx)
|
|
if client.name == "svelte" then
|
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
})
|
|
|
|
-- configure emmet language server
|
|
lspconfig["emmet_ls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
filetypes = {
|
|
"html",
|
|
"typescriptreact",
|
|
"javascriptreact",
|
|
"css",
|
|
"sass",
|
|
"scss",
|
|
"less",
|
|
"svelte",
|
|
"vue",
|
|
},
|
|
})
|
|
|
|
|
|
-- configure python lsp
|
|
lspconfig["pylsp"].setup({
|
|
filetypes = { "python" },
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
pylsp = {
|
|
pylsp = {
|
|
plugins = {
|
|
rope_autoimport = {
|
|
enabled = true,
|
|
completions = { enabled = true },
|
|
rename = { enabled = false },
|
|
},
|
|
black = { enabled = true },
|
|
autopep8 = { enabled = false },
|
|
yapf = { enabled = false },
|
|
flake8 = { enabled = true },
|
|
jedi_completion = {
|
|
enabled = true,
|
|
include_params = true,
|
|
fuzzy = true,
|
|
},
|
|
pylsp_mypy = {
|
|
enabled = true,
|
|
overrides = DPE.ResolvePythonEnvironment(),
|
|
report_progress = true,
|
|
live_mode = true,
|
|
},
|
|
-- import sorting
|
|
pyls_isort = { enabled = true },
|
|
},
|
|
},
|
|
},
|
|
})
|
|
-- configure docker server
|
|
lspconfig["dockerls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure json server
|
|
lspconfig["jsonls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure vue server
|
|
lspconfig["volar"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
filetypes = { "vue" },
|
|
})
|
|
|
|
-- configure rust server
|
|
lspconfig.rust_analyzer.setup({
|
|
-- Server-specific settings. See `:help lspconfig-setup`
|
|
on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
settings = {
|
|
["rust-analyzer"] = {},
|
|
},
|
|
})
|
|
|
|
-- configure lua server (with special settings)
|
|
lspconfig["lua_ls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = { -- custom settings for lua
|
|
Lua = {
|
|
-- make the language server recognize "vim" global
|
|
diagnostics = {
|
|
globals = { "vim" },
|
|
},
|
|
workspace = {
|
|
-- make language server aware of runtime files
|
|
library = {
|
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
-- configure css server
|
|
lspconfig["cssls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure htmx server
|
|
lspconfig["htmx"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
--configure docker file server
|
|
lspconfig["dockerls"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure docker compose server
|
|
lspconfig["docker_compose_language_service"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure eslint server
|
|
lspconfig["eslint"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure astro server
|
|
lspconfig["astro"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure kotlin server
|
|
lspconfig["kotlin_language_server"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
|
|
-- configure clang server
|
|
|
|
lspconfig["clangd"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure arduino language server
|
|
|
|
lspconfig["arduino_language_server"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- configure biome server
|
|
lspconfig["biome"].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
filetypes = {
|
|
"javascript",
|
|
"javascriptreact",
|
|
"json",
|
|
"jsonc",
|
|
"typescript",
|
|
"typescript.tsx",
|
|
"typescriptreact",
|
|
"astro",
|
|
"svelte",
|
|
"vue",
|
|
},
|
|
})
|