This commit is contained in:
Carlos
2025-02-20 00:50:00 -05:00
parent 7799a9343b
commit ae0acb574c
5 changed files with 118 additions and 49 deletions

View File

@@ -144,48 +144,48 @@ return {
-- },
-- }
dap.adapters.chrome = {
type = "executable",
command = "node",
args = { os.getenv("HOME") .. "/.local/share/nvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" },
}
dap.configurations.typescriptreact = {
{
name = "Attach to Chrome",
type = "chrome",
request = "attach",
program = "${file}",
cwd = vim.fn.getcwd(),
port = 9222, -- 🚀 Chrome debugging port
webRoot = "${workspaceFolder}",
sourceMaps = true,
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
},
{
name = "Launch Chrome with DevTools",
type = "chrome",
request = "launch",
url = "http://localhost:4000", -- Your React app runs on this port
webRoot = "${workspaceFolder}",
runtimeArgs = { "--remote-debugging-port=9222" },
sourceMaps = true,
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
},
}
dap.configurations.javascript = {
{
name = "Attach to Chrome",
type = "chrome",
request = "attach",
program = "${file}",
cwd = vim.fn.getcwd(),
port = 9222, -- 🚀 Default Chrome Debug Port
webRoot = "${workspaceFolder}",
sourceMaps = true,
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
},
}
-- dap.adapters.chrome = {
-- type = "executable",
-- command = "node",
-- args = { os.getenv("HOME") .. "/.local/share/nvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" },
-- }
--
-- dap.configurations.typescript = {
-- {
-- name = "Attach to Chrome",
-- type = "chrome",
-- request = "attach",
-- program = "${file}",
-- cwd = vim.fn.getcwd(),
-- port = 9222, -- 🚀 Chrome debugging port
-- webRoot = "${workspaceFolder}",
-- sourceMaps = true,
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
-- },
-- {
-- name = "Launch Chrome with DevTools",
-- type = "chrome",
-- request = "launch",
-- url = "http://localhost:4000", -- Your React app runs on this port
-- webRoot = "${workspaceFolder}",
-- runtimeArgs = { "--remote-debugging-port=9222" },
-- sourceMaps = true,
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
-- },
-- }
--
-- dap.configurations.javascript = {
-- {
-- name = "Attach to Chrome",
-- type = "chrome",
-- request = "attach",
-- program = "${file}",
-- cwd = vim.fn.getcwd(),
-- port = 9222, -- 🚀 Default Chrome Debug Port
-- webRoot = "${workspaceFolder}",
-- sourceMaps = true,
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
-- },
-- }
end,
}

View File

@@ -5,6 +5,14 @@ return {
local conform = require("conform")
conform.setup({
formatters = {
sqlfluff = {
command = "sqlfluff",
args = { "format", "--dialect", "postgres", "-" },
stdin = true, -- Ensure it uses stdin
cwd = require("conform.util").root_file({ ".git" }),
},
},
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
@@ -21,15 +29,17 @@ return {
liquid = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
dbml = { "dbml" }, -- DBML formatting
sql = { "sqlfluff" }, -- SQL formatting
},
format_on_save = false,
format_on_save = false, -- Set to true if you want auto-formatting on save
})
vim.keymap.set({ "n", "v" }, "<leader>mm", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
timeout_ms = 2000,
})
end, { desc = "Format file or range (in visual mode)" })
end,

View File

@@ -3,6 +3,56 @@ return {
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
local api = vim.api
local keymap = vim.keymap
lint.linters.dbml = {
cmd = "dbml",
args = { "lint" },
stdin = false,
stream = "stdout",
ignore_exitcode = true,
parser = function(output, bufnr)
local diagnostics = {}
for line in output:gmatch("[^\r\n]+") do
local lnum, col, msg = line:match("(%d+):(%d+):%s*(.*)")
if lnum and msg then
table.insert(diagnostics, {
bufnr = bufnr,
lnum = tonumber(lnum) - 1,
col = tonumber(col) - 1,
message = msg,
severity = vim.diagnostic.severity.WARN,
})
end
end
return diagnostics
end,
}
lint.linters.sqlfluff = {
cmd = "sqlfluff",
args = { "lint", "--format", "json" },
stdin = false,
stream = "stdout",
ignore_exitcode = true,
parser = function(output, bufnr)
local diagnostics = {}
local parsed = vim.fn.json_decode(output)
if parsed and parsed[1] and parsed[1].violations then
for _, issue in ipairs(parsed[1].violations) do
table.insert(diagnostics, {
bufnr = bufnr,
lnum = issue.line_no - 1,
col = issue.line_pos - 1,
message = issue.description,
severity = vim.diagnostic.severity.WARN,
})
end
end
return diagnostics
end,
}
lint.linters_by_ft = {
javascript = { "eslint_d" },
@@ -11,18 +61,20 @@ return {
typescriptreact = { "eslint_d" },
svelte = { "eslint_d" },
python = { "pylint" },
dbml = { "dbml" },
sql = { "sqlfluff" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
local lint_augroup = api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>l", function()
keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,

View File

@@ -63,6 +63,12 @@ return {
-- Navigate Forward (Enter a Folder)
vim.keymap.set("n", "<leader>f", api.tree.change_root_to_node, opts)
-- Reload the tree (useful when files are added/removed)
vim.keymap.set("n", "l", function()
api.tree.reload() -- Reload the tree
print("NvimTree reloaded!") -- Optional confirmation message
end, opts)
-- File Management keybindings
vim.keymap.set("n", "a", function() -- Add a new file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
@@ -91,7 +97,7 @@ return {
vim.keymap.set("n", "y", function() -- Copy file
vim.cmd("set modifiable") -- Ensure modifiable mode is on
api.fs.copy()
api.fs.copy.node()
end, opts)
end,
})

View File

@@ -39,6 +39,7 @@ return {
"markdown_inline",
"svelte",
"graphql",
"sql",
"bash",
"lua",
"vim",