Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rcarriga/nvim-dap-ui
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.0
Choose a base ref
...
head repository: rcarriga/nvim-dap-ui
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 6,589 additions and 3,579 deletions.
  1. +4 −3 .github/workflows/workflow.yaml
  2. +21 −0 LICENCE.md
  3. +44 −72 README.md
  4. +411 −52 doc/nvim-dap-ui.txt
  5. +11 −0 lua/dapui/client/dap_types.lua
  6. +205 −0 lua/dapui/client/init.lua
  7. +97 −0 lua/dapui/client/lib.lua
  8. +1,594 −0 lua/dapui/client/types.lua
  9. +160 −38 lua/dapui/components/breakpoints.lua
  10. +0 −78 lua/dapui/components/buf_breakpoints.lua
  11. +0 −29 lua/dapui/components/controls.lua
  12. +70 −49 lua/dapui/components/frames.lua
  13. +83 −93 lua/dapui/components/hover.lua
  14. +63 −44 lua/dapui/components/scopes.lua
  15. +69 −58 lua/dapui/components/threads.lua
  16. +91 −113 lua/dapui/components/variables.lua
  17. +129 −138 lua/dapui/components/watches.lua
  18. +93 −21 lua/dapui/config/highlights.lua
  19. +146 −119 lua/dapui/config/init.lua
  20. +156 −0 lua/dapui/controls.lua
  21. +41 −19 lua/dapui/elements/breakpoints.lua
  22. +59 −46 lua/dapui/elements/console.lua
  23. +0 −22 lua/dapui/elements/controls.lua
  24. +36 −20 lua/dapui/elements/hover.lua
  25. +51 −21 lua/dapui/elements/repl.lua
  26. +38 −13 lua/dapui/elements/scopes.lua
  27. +37 −13 lua/dapui/elements/stacks.lua
  28. +80 −14 lua/dapui/elements/watches.lua
  29. +280 −143 lua/dapui/init.lua
  30. +53 −92 lua/dapui/render/canvas.lua
  31. +0 −4 lua/dapui/render/init.lua
  32. +33 −12 lua/dapui/render/line_hover.lua
  33. +0 −117 lua/dapui/render/loop.lua
  34. +0 −371 lua/dapui/state.lua
  35. +25 −0 lua/dapui/tests/init.lua
  36. +152 −0 lua/dapui/tests/mocks.lua
  37. +48 −0 lua/dapui/tests/util.lua
  38. +169 −80 lua/dapui/util.lua
  39. +14 −8 lua/dapui/windows/float.lua
  40. +107 −68 lua/dapui/windows/init.lua
  41. +23 −31 lua/dapui/windows/layout.lua
  42. +818 −15 scripts/gendocs.lua
  43. +367 −0 scripts/generate_types
  44. +1 −0 tests/init.vim
  45. +14 −0 tests/minimal_init.lua
  46. +0 −94 tests/unit/components/breakpoints_spec.lua
  47. +0 −113 tests/unit/components/buf_breakpoint_spec.lua
  48. +0 −116 tests/unit/components/frames_spec.lua
  49. +0 −271 tests/unit/components/hover_spec.lua
  50. +0 −155 tests/unit/components/scopes_spec.lua
  51. +0 −192 tests/unit/components/threads_spec.lua
  52. +0 −286 tests/unit/components/variables_spec.lua
  53. +0 −223 tests/unit/components/watches_spec.lua
  54. +6 −6 tests/unit/config/init_spec.lua
  55. +106 −0 tests/unit/elements/breakpoints_spec.lua
  56. +108 −0 tests/unit/elements/hover_spec.lua
  57. +155 −0 tests/unit/elements/scopes_spec.lua
  58. +172 −0 tests/unit/elements/stacks_spec.lua
  59. +118 −0 tests/unit/elements/watches_spec.lua
  60. +0 −43 tests/unit/util_spec.lua
  61. +31 −64 tests/unit/windows/layout_spec.lua
7 changes: 4 additions & 3 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: JohnnyMorganz/stylua-action@1.0.0
- uses: JohnnyMorganz/stylua-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check lua/ tests/

tests:
name: tests
runs-on: ubuntu-latest
@@ -26,6 +26,7 @@ jobs:
- name: Prepare dependencies
run: |
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
git clone --depth 1 https://github.com/nvim-neotest/nvim-nio ~/.local/share/nvim/site/pack/vendor/start/nvim-nio
git clone --depth 1 https://github.com/mfussenegger/nvim-dap ~/.local/share/nvim/site/pack/vendor/start/nvim-dap
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
@@ -50,7 +51,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 20
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Rónán Carrigan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
116 changes: 44 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,107 +5,75 @@
A UI for [nvim-dap](https://github.com/mfussenegger/nvim-dap) which provides a
good out of the box configuration.

![preview](https://user-images.githubusercontent.com/24252670/188723096-db9711a2-330c-49f4-a66d-909be24b301e.png)
![preview](https://user-images.githubusercontent.com/24252670/191198389-a1321363-c0f1-4ff1-b663-ab1350d2b393.png)

## Installation

Install with your favourite package manager alongside nvim-dap
Install with your favourite package manager alongside nvim-dap and nvim-nio

[**dein**](https://github.com/Shougo/dein.vim):

```vim
call dein#add("mfussenegger/nvim-dap")
call dein#add("nvim-neotest/nvim-nio")
call dein#add("rcarriga/nvim-dap-ui")
```

[**vim-plug**](https://github.com/junegunn/vim-plug)

```vim
Plug 'mfussenegger/nvim-dap'
Plug 'nvim-neotest/nvim-nio'
Plug 'rcarriga/nvim-dap-ui'
```

[packer.nvim](https://github.com/wbthomason/packer.nvim)
[**packer.nvim**](https://github.com/wbthomason/packer.nvim)

```lua
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }
```

[**lazy.nvim**](https://github.com/folke/lazy.nvim)

```lua
{ "rcarriga/nvim-dap-ui", dependencies = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }
```

It is highly recommended to use [lazydev.nvim](https://github.com/folke/lazydev.nvim) to enable type checking for nvim-dap-ui to get
type checking, documentation and autocompletion for all API functions.

```lua
require("lazydev").setup({
library = { "nvim-dap-ui" },
})
```

The default icons use [codicons](https://github.com/microsoft/vscode-codicons).
It's recommended to use this [fork](https://github.com/ChristianChiarulli/neovim-codicons) which fixes alignment issues
for the terminal. If your terminal doesn't support font fallback and you need to have icons included in your font, you can patch it via [Font Patcher](https://github.com/ryanoasis/nerd-fonts#option-8-patch-your-own-font).
There is a simple step by step guide [here](https://github.com/mortepau/codicons.nvim#how-to-patch-fonts).

## Configuration

nvim-dap-ui is built on the idea of "elements". These elements are windows
which provide different features.

The UI is split between a sidebar which sits on the side of the screen, and a
tray which sits on the bottom of the screen by default. Both of these can
contain any of the available elements and the position of each can be changed
to any side of the screen.
Elements are grouped into layouts which can be placed on any side of the screen.
There can be any number of layouts, containing whichever elements desired.

Elements can also be displayed temporarily in a floating window.

You can supply an object to the `require("dapui").setup()` function to
configure the elements.
Each element has a set of *mappings* for element-specific possible actions, detailed below for each element.
The total set of actions/mappings and their default shortcuts are:
- `edit`: `e`
- `expand`: `<CR>` or left click
- `open`: `o`
- `remove`: `d`
- `repl`: `r`
- `toggle`: `t`

Default settings:
See `:h dapui.setup()` for configuration options and defaults.

```lua
require("dapui").setup({
icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7"),
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
"stacks",
"watches",
},
size = 40, -- 40 columns
position = "left",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
}
})
```

### Variable Scopes

@@ -201,13 +169,16 @@ You can use nvim-dap events to open and close the windows automatically (`:help

```lua
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
```
@@ -230,6 +201,7 @@ The optional settings can included the following keys:
- `width: number` Width of the window
- `height: number` Height of the window
- `enter: boolean` Enter the floating window
- `position: string` Position of floating window. `center` or `nil`

Call the same function again while the window is open and the cursor will jump
to the floating window. The REPL will automatically jump to the floating
Loading