fixing
This commit is contained in:
@@ -144,48 +144,48 @@ return {
|
|||||||
-- },
|
-- },
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
dap.adapters.chrome = {
|
-- dap.adapters.chrome = {
|
||||||
type = "executable",
|
-- type = "executable",
|
||||||
command = "node",
|
-- command = "node",
|
||||||
args = { os.getenv("HOME") .. "/.local/share/nvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" },
|
-- args = { os.getenv("HOME") .. "/.local/share/nvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js" },
|
||||||
}
|
-- }
|
||||||
|
--
|
||||||
dap.configurations.typescriptreact = {
|
-- dap.configurations.typescript = {
|
||||||
{
|
-- {
|
||||||
name = "Attach to Chrome",
|
-- name = "Attach to Chrome",
|
||||||
type = "chrome",
|
-- type = "chrome",
|
||||||
request = "attach",
|
-- request = "attach",
|
||||||
program = "${file}",
|
-- program = "${file}",
|
||||||
cwd = vim.fn.getcwd(),
|
-- cwd = vim.fn.getcwd(),
|
||||||
port = 9222, -- 🚀 Chrome debugging port
|
-- port = 9222, -- 🚀 Chrome debugging port
|
||||||
webRoot = "${workspaceFolder}",
|
-- webRoot = "${workspaceFolder}",
|
||||||
sourceMaps = true,
|
-- sourceMaps = true,
|
||||||
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
||||||
},
|
-- },
|
||||||
{
|
-- {
|
||||||
name = "Launch Chrome with DevTools",
|
-- name = "Launch Chrome with DevTools",
|
||||||
type = "chrome",
|
-- type = "chrome",
|
||||||
request = "launch",
|
-- request = "launch",
|
||||||
url = "http://localhost:4000", -- Your React app runs on this port
|
-- url = "http://localhost:4000", -- Your React app runs on this port
|
||||||
webRoot = "${workspaceFolder}",
|
-- webRoot = "${workspaceFolder}",
|
||||||
runtimeArgs = { "--remote-debugging-port=9222" },
|
-- runtimeArgs = { "--remote-debugging-port=9222" },
|
||||||
sourceMaps = true,
|
-- sourceMaps = true,
|
||||||
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
|
--
|
||||||
dap.configurations.javascript = {
|
-- dap.configurations.javascript = {
|
||||||
{
|
-- {
|
||||||
name = "Attach to Chrome",
|
-- name = "Attach to Chrome",
|
||||||
type = "chrome",
|
-- type = "chrome",
|
||||||
request = "attach",
|
-- request = "attach",
|
||||||
program = "${file}",
|
-- program = "${file}",
|
||||||
cwd = vim.fn.getcwd(),
|
-- cwd = vim.fn.getcwd(),
|
||||||
port = 9222, -- 🚀 Default Chrome Debug Port
|
-- port = 9222, -- 🚀 Default Chrome Debug Port
|
||||||
webRoot = "${workspaceFolder}",
|
-- webRoot = "${workspaceFolder}",
|
||||||
sourceMaps = true,
|
-- sourceMaps = true,
|
||||||
skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
-- skipFiles = { "<node_internals>/**", "webpack://_N_E/./node_modules/**" },
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ return {
|
|||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
|
|
||||||
conform.setup({
|
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 = {
|
formatters_by_ft = {
|
||||||
javascript = { "prettier" },
|
javascript = { "prettier" },
|
||||||
typescript = { "prettier" },
|
typescript = { "prettier" },
|
||||||
@@ -21,15 +29,17 @@ return {
|
|||||||
liquid = { "prettier" },
|
liquid = { "prettier" },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
python = { "isort", "black" },
|
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()
|
vim.keymap.set({ "n", "v" }, "<leader>mm", function()
|
||||||
conform.format({
|
conform.format({
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
async = false,
|
async = false,
|
||||||
timeout_ms = 1000,
|
timeout_ms = 2000,
|
||||||
})
|
})
|
||||||
end, { desc = "Format file or range (in visual mode)" })
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -3,6 +3,56 @@ return {
|
|||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require("lint")
|
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 = {
|
lint.linters_by_ft = {
|
||||||
javascript = { "eslint_d" },
|
javascript = { "eslint_d" },
|
||||||
@@ -11,18 +61,20 @@ return {
|
|||||||
typescriptreact = { "eslint_d" },
|
typescriptreact = { "eslint_d" },
|
||||||
svelte = { "eslint_d" },
|
svelte = { "eslint_d" },
|
||||||
python = { "pylint" },
|
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,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>l", function()
|
keymap.set("n", "<leader>l", function()
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end, { desc = "Trigger linting for current file" })
|
end, { desc = "Trigger linting for current file" })
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ return {
|
|||||||
-- Navigate Forward (Enter a Folder)
|
-- Navigate Forward (Enter a Folder)
|
||||||
vim.keymap.set("n", "<leader>f", api.tree.change_root_to_node, opts)
|
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
|
-- File Management keybindings
|
||||||
vim.keymap.set("n", "a", function() -- Add a new file
|
vim.keymap.set("n", "a", function() -- Add a new file
|
||||||
vim.cmd("set modifiable") -- Ensure modifiable mode is on
|
vim.cmd("set modifiable") -- Ensure modifiable mode is on
|
||||||
@@ -91,7 +97,7 @@ return {
|
|||||||
|
|
||||||
vim.keymap.set("n", "y", function() -- Copy file
|
vim.keymap.set("n", "y", function() -- Copy file
|
||||||
vim.cmd("set modifiable") -- Ensure modifiable mode is on
|
vim.cmd("set modifiable") -- Ensure modifiable mode is on
|
||||||
api.fs.copy()
|
api.fs.copy.node()
|
||||||
end, opts)
|
end, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ return {
|
|||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
"svelte",
|
"svelte",
|
||||||
"graphql",
|
"graphql",
|
||||||
|
"sql",
|
||||||
"bash",
|
"bash",
|
||||||
"lua",
|
"lua",
|
||||||
"vim",
|
"vim",
|
||||||
|
|||||||
Reference in New Issue
Block a user