Dotfiles/nvim/lua/plugins/code-lsp.lua

163 lines
3.7 KiB
Lua
Raw Normal View History

2024-02-24 19:53:17 +00:00
return {
{
"williamboman/mason.nvim",
lazy = false,
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
opts = {
auto_install = true,
},
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"bashls",
"dotls",
"jsonls",
"sqlls",
"lemminx",
"yamlls",
"marksman",
"html",
"emmet_ls",
"cssls",
"tailwindcss",
"tsserver",
"stimulus_ls",
"svelte",
"volar",
"eslint",
"phpactor",
"gopls",
"rust_analyzer",
"jdtls",
"kotlin_language_server",
"pylsp"
}
})
end
},
{
"neovim/nvim-lspconfig",
lazy = false,
config = function()
-- Setup --
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require("lspconfig")
-- Lua support --
lspconfig.lua_ls.setup({
capabilities = capabilities
})
-- Bash support --
lspconfig.bashls.setup({
capabilities = capabilities
})
-- Dotenv support --
lspconfig.dotls.setup({
capabilities = capabilities
})
-- JSON support --
lspconfig.jsonls.setup({
capabilities = capabilities
})
-- SQL support --
lspconfig.sqlls.setup({
capabilities = capabilities
})
-- XML support --
lspconfig.lemminx.setup({
capabilities = capabilities
})
-- YAML support --
lspconfig.yamlls.setup({
capabilities = capabilities
})
-- Markdown support --
lspconfig.marksman.setup({
capabilities = capabilities
})
-- HTML support --
lspconfig.html.setup({
capabilities = capabilities
})
-- Emmet support --
lspconfig.emmet_ls.setup({
capabilities = capabilities
})
-- PHP support --
lspconfig.phpactor.setup({
capabilities = capabilities
})
-- CSS & SCSS support --$response
lspconfig.cssls.setup({
capabilities = capabilities
})
-- Tailwind support --
lspconfig.tailwindcss.setup({
capabilities = capabilities
})
-- JavaScript & TypeScript support --
lspconfig.tsserver.setup({
capabilities = capabilities
})
-- Stimulus support --
lspconfig.stimulus_ls.setup({
capabilities = capabilities
})
-- Svelte support --
lspconfig.svelte.setup({
capabilities = capabilities
})
-- Vue support --
lspconfig.volar.setup({
capabilities = capabilities
})
-- Go support --
lspconfig.gopls.setup({
capabilities = capabilities
})
-- Rust support --
lspconfig.rust_analyzer.setup({
capabilities = capabilities
})
-- Java support --
lspconfig.jdtls.setup({
capabilities = capabilities
})
-- Kotlin support --
lspconfig.kotlin_language_server.setup({
capabilities = capabilities
})
-- Python support --
lspconfig.pylsp.setup({
capabilities = capabilities
})
-- Eslint support --
lspconfig.eslint.setup({
capabilities = capabilities
})
-- Keybinding --
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
end
}
}