Skip to content

Commit 783cf9e

Browse files
committed
document switchbuf as function
1 parent 35c7816 commit 783cf9e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

doc/dap.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,19 @@ The configuration values are set via `dap.defaults.fallback` (for global) or
588588
threads to be able to stop, you may want to set this to false.
589589
Defaults to true.
590590

591-
- switchbuf. (string). Controls the behavior when jumping to a breakpoint.
592-
See |'switchbuf'|. Defaults to the global `'switchbuf'`
593-
setting.
594-
595-
nvim-dap provides an additional `usevisible` option
596-
that can be used to prevent jumps within the active
597-
window if a stopped event is within the visible region.
598-
Best used in combination with other options. For
599-
example: 'usevisible,usetab,uselast'
591+
- switchbuf. (string|fun). Controls the behavior when jumping to a
592+
breakpoint. See |'switchbuf'|. Defaults to the global `'switchbuf'` setting.
593+
594+
nvim-dap provides an additional `usevisible` option
595+
that can be used to prevent jumps within the active
596+
window if a stopped event is within the visible region.
597+
Best used in combination with other options. For
598+
example: 'usevisible,usetab,uselast'
599+
600+
For more complex use cases, nvim-dap allows overriding with a function. The
601+
function receives 3 arguments: (bufnr, line, column). It has full control of
602+
how Neovim should behave and it is not expected to return anything.
603+
600604

601605
- `on_output`. A function with two parameters: `session` and `output_event`:
602606
Overrides the default output handling with a custom handler.

lua/dap.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ M.defaults = setmetatable(
168168
focus_terminal = false,
169169
auto_continue_if_many_stopped = true,
170170

171-
---@type string|fun(bufnr: integer, line: integer, column: integer)|nil
171+
---@type string|fun(bufnr: integer, line: integer, column: integer):nil|nil
172172
switchbuf = nil,
173173

174174
---@type nil|fun(session: dap.Session, output: dap.OutputEvent)

0 commit comments

Comments
 (0)