chore: remove ecolog, i don't use it

This commit is contained in:
Mariano Z. 2025-03-24 13:07:00 -03:00
parent c48f8a2b92
commit 1020911f18
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
7 changed files with 164 additions and 105 deletions

View file

@ -5,8 +5,13 @@ local M = {
local function setup_keymaps(trouble)
-- Diagnostic navigation
nmap("[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
nmap("]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
nmap("[d", function()
vim.diagnostic.jump({ count = -1, float = true })
end, { desc = "Previous diagnostic" })
nmap("]d", function()
vim.diagnostic.jump({ count = 1, float = true })
end, { desc = "Next diagnostic" })
-- Trouble specific navigation
nmap("<a-k>", function()

View file

@ -1,59 +1,24 @@
local M = {
{
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
cloak_character = "*",
highlight_group = "Comment",
patterns = {
{
file_pattern = {
".env*",
"wrangler.toml",
".dev.vars",
},
cloak_pattern = "=.+",
},
},
})
nmap("<Leader>cc", ":CloakToggle<cr>")
end,
},
{
"philosofonusus/ecolog.nvim",
keys = {
{ "<leader>ge", "<cmd>EcologGoto<cr>", desc = "Go to env file" },
{ "<leader>ep", "<cmd>EcologPeek<cr>", desc = "Ecolog peek variable" },
{ "<leader>es", "<cmd>EcologSelect<cr>", desc = "Switch env file" },
},
-- Lazy loading is done internally
lazy = false,
opts = {
integrations = {
blink_cmp = true,
},
-- Enables shelter mode for sensitive values
shelter = {
configuration = {
partial_mode = false, -- false by default, disables partial mode, for more control check out shelter partial mode
mask_char = "*", -- Character used for masking
},
modules = {
cmp = true, -- Mask values in completion
peek = false, -- Mask values in peek view
files = false, -- Mask values in files
telescope = false, -- Mask values in telescope
},
},
-- true by default, enables built-in types (database_url, url, etc.)
types = true,
path = vim.fn.getcwd(), -- Path to search for .env files
preferred_environment = "development", -- Optional: prioritize specific env files
},
},
"laytan/cloak.nvim",
}
M.config = function() end
M.config = function()
require("cloak").setup({
cloak_character = "*",
highlight_group = "Comment",
patterns = {
{
file_pattern = {
".env*",
"wrangler.toml",
".dev.vars",
},
cloak_pattern = "=.+",
},
},
})
nmap("<Leader>cc", ":CloakToggle<cr>")
end
return M

View file

@ -1,10 +1,68 @@
return {
"yioneko/nvim-vtsls",
"pmizio/typescript-tools.nvim",
dependencies = {
"dmmulroy/ts-error-translator.nvim",
"nvim-lua/plenary.nvim",
"neovim/nvim-lspconfig",
},
config = function()
require("ts-error-translator").setup()
end,
ft = { "typescript", "javascript", "jsx", "tsx", "json" },
config = function()
local lsp_common = require("plugins.lsp").get_common_config()
local ts_api = require("typescript-tools.api")
local original_on_attach = lsp_common.on_attach
lsp_common.on_attach = function(client, bufnr)
original_on_attach(client, bufnr)
vim.keymap.set("n", "<leader>ca", function()
local diagnostics = vim.diagnostic.get(0, { lnum = vim.fn.line(".") - 1 })
local context = { diagnostics = diagnostics }
local params = vim.lsp.util.make_range_params(0)
params.context = context
params = vim.tbl_extend("force", {}, params)
vim.lsp.buf_request(bufnr, "textDocument/codeAction", params, function(err, result, ctx)
local actions = result or {}
table.insert(actions, { title = "Organize Imports", command = "typescript.custom.organize_imports" })
table.insert(actions, { title = "Fix All", command = "typescript.custom.fix_all" })
table.insert(actions, { title = "Add Missing Imports", command = "typescript.custom.add_missing_imports" })
table.insert(actions, { title = "Remove Unused", command = "typescript.custom.remove_unused" })
vim.ui.select(actions, {
prompt = "Code Actions",
format_item = function(action)
return action.title
end,
}, function(action)
if not action then
return
end
if action.command == "typescript.custom.organize_imports" then
pcall(ts_api.organize_imports)
elseif action.command == "typescript.custom.fix_all" then
pcall(ts_api.fix_all)
elseif action.command == "typescript.custom.add_missing_imports" then
pcall(ts_api.add_missing_imports)
elseif action.command == "typescript.custom.remove_unused" then
pcall(ts_api.remove_unused)
else
if action.edit or type(action.command) == "table" then
if action.edit then
vim.lsp.util.apply_workspace_edit(action.edit, "utf-8")
end
if type(action.command) == "table" then
vim.lsp.buf.execute_command(action.command)
end
end
end
end)
end)
end, { buffer = bufnr, desc = "Code Actions" })
end
require("typescript-tools").setup(vim.tbl_deep_extend("force", lsp_common, {
settings = {
separate_diagnostic_server = true,
publish_diagnostic_on = "insert_leave",
expose_as_code_action = {},
},
}))
end,
}

View file

@ -30,9 +30,22 @@ end
-- Set up key mappings for LSP functionality
local function setup_keymaps(bufnr)
local BORDER = "rounded"
local keymaps = {
{ "<C-h>", vim.lsp.buf.signature_help, "Signature Help" },
-- { "K", vim.lsp.buf.hover, "Hover Doc"},
{
"<C-h>",
function()
vim.lsp.buf.signature_help({ border = BORDER })
end,
"Signature Help",
},
{
"K",
function()
vim.lsp.buf.hover({ border = BORDER })
end,
"Hover Doc",
},
{ "<leader>cw", vim.lsp.buf.rename, "Rename" },
{ "<leader>r", vim.lsp.buf.rename, "Rename" },
{ "vd", vim.diagnostic.open_float, "Open Diagnostics" },
@ -49,18 +62,27 @@ local function setup_keymaps(bufnr)
end
-- Function called when LSP attaches to a buffer
local function on_attach(client, bufnr)
function M.on_attach(client, bufnr)
setup_autocommands(client, bufnr)
setup_keymaps(bufnr)
end
local BORDER = "rounded"
-- Function to get common LSP configuration
function M.get_common_config()
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- Customize hover and signature help handlers
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = BORDER }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = BORDER }),
}
-- Enable folding capabilities
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
return {
on_attach = M.on_attach,
capabilities = capabilities,
flags = { debounce_text_changes = 150 },
}
end
function M.config()
-- Set up Mason
@ -78,7 +100,6 @@ function M.config()
"json-lsp",
"lua-language-server",
"omnisharp",
"vtsls",
"yaml-language-server",
"svelte-language-server",
@ -118,20 +139,7 @@ function M.config()
},
handlers = {
function(server_name)
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- Enable folding capabilities
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local base_opts = {
on_attach = on_attach,
capabilities = capabilities,
handlers = handlers,
flags = { debounce_text_changes = 150 },
}
local base_opts = M.get_common_config()
-- Load server-specific configuration if it exists
local ok, server_opts = pcall(require, "config.lsp." .. server_name)
@ -148,12 +156,7 @@ function M.config()
-- Set up non-Mason LSP servers
local non_mason_servers = { "ccls" }
for _, server in ipairs(non_mason_servers) do
require("lspconfig")[server].setup({
on_attach = on_attach,
capabilities = require("blink.cmp").get_lsp_capabilities(),
handlers = handlers,
flags = { debounce_text_changes = 150 },
})
require("lspconfig")[server].setup(M.get_common_config())
end
end