Migrate to native lsp config and other misc stuff

This commit is contained in:
Fábio André Damas 2025-09-19 22:04:09 +01:00
parent 50031cba0e
commit 2b05047eb9
21 changed files with 82 additions and 40 deletions

View file

@ -12,6 +12,7 @@ opt.colorcolumn = "80"
opt.clipboard:append({ "unnamed", "unnamedplus" })
opt.expandtab = true
opt.exrc = true
opt.foldmethod = "indent"
opt.foldcolumn = "1"
opt.foldlevel = 99
opt.foldlevelstart = 99

View file

@ -126,6 +126,10 @@ return {
{
cmd = ":OutputPanel<CR>",
desc = "Toggle LSP Output Panel"
},
{
cmd = ":I18nAddKey<CR>",
desc = "I18n: Add key under cursor"
}
})

View file

@ -1,11 +0,0 @@
return {
"nabekou29/js-i18n.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
},
event = { "BufReadPre", "BufNewFile" },
opts = {},
enabled = false
}

View file

@ -15,17 +15,20 @@ return {
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require('lspconfig')
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
for _, v in ipairs(vim.api.nvim_get_runtime_file('lua/lsp/*', true)) do
vim.lsp.config('*', { capabilities })
for _, v in ipairs(vim.api.nvim_get_runtime_file('lua/lsp_extend/*', true)) do
local name = vim.fn.fnamemodify(v, ':t:r')
local cfg = require("lsp/" .. name)
if lspconfig[name].setup ~= nil then
lspconfig[name].setup(vim.tbl_deep_extend("force", cfg, { capabilities }))
local cfg = require("lsp_extend/" .. name)
if vim.lsp.config[name] ~= nil then
vim.lsp.config(name, vim.tbl_deep_extend("force", cfg, {
settings = { [name] = { capabilities } }
}))
vim.lsp.enable(name)
else
vim.notify("LSP server " .. name .. " does not have a setup function", vim.log.levels.ERROR)
end
@ -37,11 +40,12 @@ return {
opts = {
tools_to_install = {
"lua-language-server", "vtsls", "ruff", "mypy", "black",
"pyright", "emmet-language-server", "tailwindcss-language-server",
"eslint-lsp", "lemminx", "gopls", "prettierd", "dotenv-linter",
"editorconfig-checker", "rust-analyzer", "taplo", "kulala-fmt",
"json-lsp", "harper-ls", "proselint", "alex", "yaml-language-server",
"tree-sitter-cli", "lua-language-server", "vtsls", "ruff",
"mypy", "black", "pyright", "emmet-language-server",
"tailwindcss-language-server", "eslint-lsp", "lemminx",
"gopls", "prettierd", "dotenv-linter", "editorconfig-checker",
"rust-analyzer", "taplo", "kulala-fmt", "json-lsp",
"harper-ls", "proselint", "alex", "yaml-language-server",
"golangci-lint-langserver", "golangci-lint"
}
},

View file

@ -1,9 +1,55 @@
return {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
build = ':TSUpdate',
-- dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
-- branch = 'main',
branch = 'master',
lazy = false,
config = function()
-- require 'nvim-treesitter'.setup {
-- -- Directory to install parsers and queries to
-- install_dir = vim.fn.stdpath('data') .. '/site'
-- }
--
--
-- local ensureInstalled = {
-- "c",
-- "lua",
-- "vim",
-- "vimdoc",
-- "query",
-- "elixir",
-- "heex",
-- "javascript",
-- "html",
-- "markdown",
-- "markdown_inline",
-- "html",
-- "jsdoc",
-- "hurl",
-- "typescript",
-- "json"
-- }
-- local alreadyInstalled = require("nvim-treesitter.config").get_installed()
-- local parsersToInstall = vim.iter(ensureInstalled)
-- :filter(function(parser) return not vim.tbl_contains(alreadyInstalled, parser) end)
-- :totable()
-- require("nvim-treesitter").install(parsersToInstall)
--
-- vim.api.nvim_create_autocmd("FileType", {
-- desc = "User: enable treesitter highlighting",
-- callback = function(ctx)
-- -- highlights
-- local hasStarted = pcall(vim.treesitter.start) -- errors for filetypes with no parser
--
-- -- indent
-- local noIndent = {}
-- if hasStarted and not vim.list_contains(noIndent, ctx.match) then
-- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
-- end
-- end,
-- })
require("nvim-treesitter.configs").setup({
ensure_installed = {
"c",