Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): Add support for dap for JS #475

Merged
merged 3 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/astrocommunity/pack/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This plugin pack does the following:
- Adds `eslint_d` linter
- Adds [JSON language support](../json)
- ~~Adds [nvim-dap-vscode-js](https://github.com/mxsdev/nvim-dap-vscode-js) for debugging~~ Currently broken
Uzaaft marked this conversation as resolved.
Show resolved Hide resolved
Uzaaft marked this conversation as resolved.
Show resolved Hide resolved
- Adds support for dap for JS
- Adds [typescript.nvim](https://github.com/jose-elias-alvarez/typescript.nvim) for language specific tooling
- Adds [package-info.nvim](https://github.com/vuki656/package-info.nvim) for project package management
- Handles file imports on rename or move within neo-tree
44 changes: 44 additions & 0 deletions lua/astrocommunity/pack/typescript/deno.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local utils = require "astronvim.utils"

return {
"mfussenegger/nvim-dap",
optional = true,
config = function()
local dap = require "dap"
dap.adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "node",
args = {
require("mason-registry").get_package("js-debug-adapter"):get_install_path()
.. "/js-debug/src/dapDebugServer.js",
"${port}",
},
},
}
local js_config = {
{
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}",
},
}

if not dap.configurations.javascript then
dap.configurations.javascript = js_config
else
utils.extend_tbl(dap.configurations.javascript, js_config)
end
end,
}