API
The API offers the same functionality as the commands .
Open
require("dap-view").open() Opens both nvim-dap-view windows1: views + console.
Close
---@param hide_terminal? boolean
require("dap-view").close() Closes the views window. Can also hide the terminal window if specified.
Toggle
---@param hide_terminal? boolean
require("dap-view").toggle() Calls require("dap-view").open() if there's no views window. Else, behaves like require("dap-view").close()
Add Expression
---@param expr? string
---@param default_expanded? boolean
require("dap-view").add_expr(expr, default_expanded) In normal mode, adds the expression under the cursor to the watch list (see caveats ). In visual mode, adds the selection to the watch list. If expr is specified, adds the expression directly, overriding previous conditions. Expressions are expanded (non recursively). This behavior can be overridden by setting default_expanded to false.
Jump To View
---@param view "breakpoints" | "exceptions" | "watches" | "repl" | "threads" | "console" | "scopes" | "sessions" | string
require("dap-view").jump_to_view(view) Shows a given view and jumps to its window.
Show View
---@param view "breakpoints" | "exceptions" | "watches" | "repl" | "threads" | "console" | "scopes" | "sessions" | string
require("dap-view").show_view(view) Shows a given view. If the specified view is already the current one, jumps to its window.
Navigate
---@param opts {count: number, wrap: boolean, type?: 'views' | 'sessions'}
require("dap-view").navigate(opts) Switches from the current view to another one by taking the current view's index (in the winbar) and adding a count (default behavior). Can also be used to navigate within sessions, if specified. Has some default keymaps .
Hover
---@param expr? string
---@param enter? boolean
---@param opts? {context: "watch" | "repl" | "hover" | "clipboard" | "variables" | string}
require("dap-view").hover(expr, enter, opts) In normal mode, opens the hover window with the variable under the cursor. In visual mode, opens the hover window with the selection. If expr is not nil, it is evaluated directly, skipping previous conditions. enter focuses the window, but if the window exists and it's not focused, the window will be focused regardless of this parameter.
Use opts to further customize the hover. Particularly, using opts.context as "repl" might be useful for some adapters. See #181 .
Virtual Text
Fine grained control over displaying virtual text .
Enable
require("dap-view").virtual_text_enable() Disable
require("dap-view").virtual_text_disable() Toggle
require("dap-view").virtual_text_toggle() Footnotes
In the current tab. May close the views window in another tab. ↩