pimp up nvim functionality for other languages (not only Python)

This commit is contained in:
Mathias Schneider
2026-04-07 13:29:31 +02:00
parent e674149cdf
commit d1cab8ceef
6 changed files with 88 additions and 3 deletions
+2 -1
View File
@@ -5,7 +5,8 @@ sudo pacman -S --needed \
fastfetch \ fastfetch \
tree-sitter-cli \ tree-sitter-cli \
ruff \ ruff \
python-ruff python-ruff \
chromium
npm install -g vscode-js-debug npm install -g vscode-js-debug
npm install -g eslint_d npm install -g eslint_d
@@ -11,6 +11,17 @@ return {
"theHamsta/nvim-dap-virtual-text", "theHamsta/nvim-dap-virtual-text",
dependencies = "mfussenegger/nvim-dap", dependencies = "mfussenegger/nvim-dap",
}, },
{
"mxsdev/nvim-dap-vscode-js",
dependencies = {
"mfussenegger/nvim-dap",
{
"microsoft/vscode-js-debug",
version = "1.x",
build = "npm ci --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out",
},
},
},
{ {
"mfussenegger/nvim-dap-python", "mfussenegger/nvim-dap-python",
dependencies = "mfussenegger/nvim-dap", dependencies = "mfussenegger/nvim-dap",
@@ -19,6 +30,52 @@ return {
local dapui = require("dapui") local dapui = require("dapui")
require("dap-python").setup() require("dap-python").setup()
-- JavaScript/TypeScript debugging
require("dap-vscode-js").setup({
debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug",
adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" },
})
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "launch",
name = "Debug Jest Tests",
runtimeExecutable = "node",
runtimeArgs = {
"./node_modules/jest/bin/jest.js",
"--runInBand",
},
rootPath = "${workspaceFolder}",
cwd = "${workspaceFolder}",
console = "integratedTerminal",
internalConsoleOptions = "neverOpen",
},
{
type = "pwa-chrome",
request = "launch",
name = "Launch Chrome",
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
},
}
end
dapui.setup({ dapui.setup({
icons = { expanded = "", collapsed = "", current_frame = "" }, icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = { mappings = {
@@ -10,7 +10,15 @@ return {
jsx = { "prettier", "eslint" }, jsx = { "prettier", "eslint" },
typescript = { "prettier", "eslint" }, typescript = { "prettier", "eslint" },
typescriptreact = { "prettier", "eslint" }, typescriptreact = { "prettier", "eslint" },
json = { "prettier" },
jsonc = { "prettier" },
html = { "prettier" },
css = { "prettier" },
scss = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
sh = { "shfmt" }, sh = { "shfmt" },
bash = { "shfmt" },
}, },
format_on_save = { format_on_save = {
timeout_ms = 500, timeout_ms = 500,
@@ -7,6 +7,12 @@ return {
typescript = { "eslint_d" }, typescript = { "eslint_d" },
typescriptreact = { "eslint_d" }, typescriptreact = { "eslint_d" },
python = { "ruff" }, python = { "ruff" },
lua = { "selene" },
sh = { "shellcheck" },
bash = { "shellcheck" },
json = { "jsonlint" },
yaml = { "yamllint" },
markdown = { "markdownlint" },
} }
vim.api.nvim_create_autocmd({ "BufWritePost" }, { vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+1 -1
View File
@@ -4,7 +4,7 @@ return {
config = function() config = function()
require("toggleterm").setup({ require("toggleterm").setup({
size = 10, size = 10,
open_mapping = [[<c-ß>]], open_mapping = [[<C-ß>]],
hide_numbers = true, hide_numbers = true,
shade_filetypes = {}, shade_filetypes = {},
shade_terminals = true, shade_terminals = true,
+14 -1
View File
@@ -8,7 +8,20 @@ return {
if ok then if ok then
configs.setup({ configs.setup({
auto_install = true, auto_install = true,
ensure_installed = { "python", "lua", "json", "yaml", "javascript", "typescript" }, ensure_installed = {
"python",
"lua",
"json",
"yaml",
"javascript",
"typescript",
"tsx",
"html",
"css",
"bash",
"markdown",
"markdown_inline",
},
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
folding = { enable = true }, folding = { enable = true },