Skip to content

Commit

Permalink
docs: mention dap configs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoP committed Jun 28, 2024
1 parent 52469ed commit c93dd8f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,44 @@ vim.keymap.set("n", "<leader>E", function() require("powershell").eval() end)

You could also use a filetype autocmd to create the keymap.

## DAP

By default, the plugin includes the following [nvim-dap](https://github.com/mfussenegger/nvim-dap) configurations:

```lua
dap.configurations.ps1 = {
{
name = "PowerShell: Launch Current File",
type = "ps1",
request = "launch",
script = "${file}",
},
{
name = "PowerShell: Launch Script",
type = "ps1",
request = "launch",
script = function()
return coroutine.create(function(co)
vim.ui.input({
prompt = 'Enter path or command to execute, for example: "${workspaceFolder}/src/foo.ps1" or "Invoke-Pester"',
completion = "file",
}, function(selected) coroutine.resume(co, selected) end)
end)
end,
},
{
name = "PowerShell: Attach to PowerShell Host Process",
type = "ps1",
request = "attach",
processId = "${command:pickProcess}",
},
}
```

To use them, simply call `require('dap').continue()` inside of a `ps1` file.

**NOTE**: currently, debugging does not support launching an integrated terminal because of [PowerShell/PowerShellEditorServices#2164](https://github.com/PowerShell/PowerShellEditorServices/issues/2164)

## TODO

- [ ] Tests
2 changes: 1 addition & 1 deletion lua/powershell/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ M.eval = function()
:map(function(line) return line .. "\r" end)
:each(function(line) api.nvim_chan_send(term_channel, line) end)

-- HACK: for some reason, the neovim terminal does not update when using this
-- TODO: wait for response on https://github.com/PowerShell/PowerShellEditorServices/issues/2164
-- local client = assert(vim.lsp.get_client_by_id(client_id))
-- client.request("evaluate", { expression = text }, util.noop, 0)
end
Expand Down

0 comments on commit c93dd8f

Please sign in to comment.