An extension for nvim-dap providing default configurations for powershell. Supports launch and attach configurations.
- Requires Neovim >= 0.5
- Requires nvim-dap
- Requires Powershell Editor Services
- Installation:
{
"Willem-J-an/nvim-dap-powershell",
dependencies = {
"nvim-lua/plenary.nvim",
"mfussenegger/nvim-dap",
"rcarriga/nvim-dap-ui",
{
"m00qek/baleia.nvim",
lazy = true,
tag = "v1.4.0",
},
},
config = function()
require("dap-powershell").setup()
end,
}
{
include_configs = true,
pwsh_executable = "pwsh",
pses_bundle_path -- Default path for PowerShell Editor Services bundle if installed through mason.
}
Launch.json refers to powershell as type = PowerShell, but nvim-dap refers to the filetype, default = ps1. Dap configurations are expected to be set for PowerShell, and will then work for PowerShell, ps1, psm1 filetypes.
Powershell Editor Services send back ANSI color coded error messages. These are not correctly parsed out of the box. To fix this it is recommended to configure the following after the dapui is initialized:
local dapui = require("dapui")
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
require('dap-powershell').correct_repl_colors()
end
If you call the require('dap-powershell').setup
method it will create a few nvim-dap
configuration entries.
These configurations are general purpose configurations suitable for many use cases, but you may need to customize the configurations.
To add your own entries, you can extend the dap.configurations.PowerShell
list after calling the setup
function:
lua << EOF
require('dap-powershell').setup()
table.insert(require('dap').configurations.PowerShell, {
type = 'PowerShell',
request = 'launch',
name = 'My custom launch configuration',
script = '${file}',
})
EOF
An alternative is to use project specific .vscode/launch.json
files, see :help dap-launch.json
.