Git Product home page Git Product logo

nvim-dap-ui's People

Contributors

adelarsq avatar albertfgu avatar alexvzyl avatar arsemy avatar badloop avatar brotifypacha avatar dasupradyumna avatar david-kunz avatar epsilonku avatar farhanmustar avatar hiphish avatar joseflitos avatar lbrayner avatar littletealeaf avatar marko-cerovac avatar megalithic avatar mfussenegger avatar mikesmithgh avatar mintelm avatar nyngwang avatar przepompownia avatar quitlox avatar raffaem avatar raj-magesh avatar rayjameson avatar rcarriga avatar reisz avatar robsonpeixoto avatar serranomorante avatar thehamsta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nvim-dap-ui's Issues

Weird behaviour when calling toggle() when tray set to not open on start

When I start a debugging session, the sidebar opens as expected. In my case I have set the tray to not open on start, so it does not appear with the sidebar:

dapui.setup({
  ...
  sidebar = {
    open_on_start = true,
    ...
  },
  tray = {
    open_on_start = false,
    ...
  },
  ...
})

When I call require("dapui").toggle() to hide the sidebar, the sidebar goes but the tray opens up.

This is technically correct, since the tray visibility has been toggled. But ideally, I would like to disable the tray becoming visible on toggle, since open_on_start is false.

Is this something that can be addressed in the plugin, or should users come up with a workaround for cases like these in personal configs?

stacks.lua:32: attempt to concatenate field 'line' (a nil value)

i get the following error:

Error executing vim.schedule lua callback: ...ack/packer/opt/nvim-dap-ui/lua/dapui/elements/stacks.lua:32: attempt to concatenate field 'line' (a nil value)
Error executing vim.schedule lua callback: ...ack/packer/opt/nvim-dap-ui/lua/dapui/elements/stacks.lua:32: attempt to concatenate field 'line' (a nil value)

it will just throw the error debugging works like intended
this happens every time i hit a breakpoint
also scope window is empty stacks says no expressions

i guess this might be my configuration somewhat link to nvim dotfiles

this is the config that gets loaded when i lazyload dap

local dap = require "dap"

dap.adapters.node2 = {
    type = "executable",
    command = "node",
    args = {os.getenv("HOME") .. "/code/vscode-node-debug2/out/src/nodeDebug.js"}
}

vim.fn.sign_define("DapBreakpoint", {text = "๐Ÿ›‘", texthl = "", linehl = "", numhl = ""})
vim.fn.sign_define("DapStopped", {text = "๐ŸŸข", texthl = "", linehl = "", numhl = ""})

dap.configurations.typescript = {
    {
        type = "node2",
        request = "attach",
        program = "${file}",
        cwd = vim.fn.getcwd(),
        sourceMaps = true,
        protocol = "inspector"
    }
}

require("dapui").setup()

this is how i attach with lazyloading

local function attach()
    print("attaching")
    if not packer_plugins["nvim-dap"].loaded then
        vim.cmd [[packadd nvim-dap]]
        vim.cmd [[packadd nvim-dap-ui]]
    end
    require("plugins.dap")
    local dap = require "dap"
    dap.run(
        {
            type = "node2",
            request = "attach",
            cwd = vim.fn.getcwd(),
            sourceMaps = true,
            protocol = "inspector",
            skipFiles = {"<node_internals>/**/*.ts"}
        }
    )
end

return {
    attach = attach
}

when nvim loads it wont load dap or dapui
when i press my mapping to trigger the attach() function dap and dapui gets loaded

flow is as follows:

  1. Run Neovim
  2. press space d h l - to attach to debugger
  3. set breakpoints
  4. trigger something in app to hit breakpoint
  5. when app reaches breakpoint the errors pop up

Close Mapping Does not Work for Floating REPL

I have the following configuration:

dapui.setup({
  floating = {
    mappings = {
      close = { '<C-d>' },
    },
  },
})

Pressing <C-d> is able to close floats which have elements such as scopes, but if the floating element is repl, it does not close when I press <C-d>, I instead have to press <C-w> and switch to another split.

I want to create custom mappings in the dapui elements

I'd like to create some custom buffer-local mappings inside the dapui elements, just for convenience (e.g., taking a hint from spice.vim, i'm mapping r to go to repl, w to go to watches, โ€ฆ). I am currently using the following patch just to see if the idea can be made to work, with

require('dapui').setup({
  custom_mappings = {
    { "n", "<leader>w", "<cmd>1wincmd w<CR>", { noremap = true } },
    { โ€ฆ },
  },
})
diff --git a/lua/dapui/config/init.lua b/lua/dapui/config/init.lua
index 1ed4ff0..7dd316a 100644
--- a/lua/dapui/config/init.lua
+++ b/lua/dapui/config/init.lua
@@ -61,6 +61,7 @@ local default_config = {
     },
   },
   windows = { indent = 1 },
+  custom_mappings = {},
 }

 local user_config = {}
@@ -91,6 +92,7 @@ function M.setup(config)
   local filled = vim.tbl_deep_extend("keep", config or {}, default_config)
   filled.mappings = fill_mappings(filled.mappings)
   filled.floating.mappings = fill_mappings(filled.floating.mappings)
+  filled.custom_mappings = filled.custom_mappings or {}
   filled.sidebar = fill_elements(filled.sidebar)
   filled.tray = fill_elements(filled.tray)
   user_config = filled
@@ -121,4 +123,8 @@ function M.windows()
   return user_config.windows
 end

+function M.custom_mappings()
+  return user_config.custom_mappings
+end
+
 return M
diff --git a/lua/dapui/render/state.lua b/lua/dapui/render/state.lua
index a3e36fc..6130342 100644
--- a/lua/dapui/render/state.lua
+++ b/lua/dapui/render/state.lua
@@ -170,6 +170,9 @@ function M.render_buffer(state, buffer)
     api.nvim_buf_set_option(buffer, "modifiable", false)
     api.nvim_buf_set_option(buffer, "buftype", "nofile")
   end
+  for _, t in pairs(config.custom_mappings()) do
+      api.nvim_buf_set_keymap(buffer, unpack(t))
+  end
   return true
 end

This does work for me, but it's fragile because it depends on the windows being laid out on screen in a certain way (the default, I didn't bother to change anything). If you're at all interested in the idea, do you have any advice on how to do it more nicely?

floating window should expand if possible

When the floating window height is set to a large number, e.g. 1.0, or 0.9, I would expect it to fill the grow up to this size to show all variables if possible.

The recording here shows that it could grow slightly to show all the variables but it doesn't, giving the impression that the height value is being ignored.

eval does not work as expected using jdtls

When hovering over a variable (reference to some object), and doing :lua require'dapui'.eval(), a popup window containing a single integer shows up. I can't find any sort of relationship between that integer and the actual value of the object.
image

This is really a shame becasue dap.ui.variables.hover() gives great results, but the window behavior is weird. dapui.eval() has fantastic window behaviour, but the actual results make no sense.

Invalid Window ID for DAP_REPL

Here is the relevant details on my setup:

DAP config in init.lua:

local dap = require('dap')
dap.adapters.python = {
  type = 'executable';
  command = os.getenv('USERPROFILE') .. '\\AppData\\Local\\nvim\\debugpy\\Scripts\\python.exe';
  args = { '-m', 'debugpy.adapter' };
}
dap.configurations.python = {
  {
    type = 'python';
    request = 'launch';
    name = "Launch file";
    program = "${file}";
    pythonPath = vim.fn.getcwd() .. '\\.venv\\Scripts\\python.exe';
    console = 'integratedTerminal';
  },
}
require('dapui').setup()

Output of :version:

NVIM v0.5.0-dev+1233-g82ac44d01
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -ID:/a/neovim/neovim/build/config -ID:/a/neovim/neovim/src -IC:/projects/nvim-deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include
Compiled by runneradmin@fv-az152-151

Features: -acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM\sysinit.vim"
  fall-back for $VIM: "C:/Program Files/nvim/share/nvim"

Run :checkhealth for more info

starting the DAP with :lua require('dap').continue() works wonderfully, and all the windows are properly setup. The DAP repl works great and as expected also. When .exit is executed at the repl, though, things break down. I added print(vim.inspect(sidebar_windows)) and print(vim.inspect(tray_windows)) here and here, and here is the output when .exit is run at the repl:

{
  [1003] = {
    float_defaults = {
      enter = true,
      height = 20,
      width = 80
    },
    name = "DAP REPL",
    on_close = <function 1>,
    on_open = <function 2>,
    setup = <function 3>
  }
}
Error executing vim.schedule lua callback: ...ata\Local\nvim\plugged\nvim-dap-ui\lua\dapui\windows.lua:47: Invalid window id: 1003
{
  [1003] = {
    float_defaults = {
      enter = true,
      height = 20,
      width = 80
    },
    name = "DAP REPL",
    on_close = <function 1>,
    on_open = <function 2>,
    setup = <function 3>
  }
}
Error executing vim.schedule lua callback: ...ata\Local\nvim\plugged\nvim-dap-ui\lua\dapui\windows.lua:47: Invalid window id: 1003
Press ENTER or type command to continue

I haven't dug into it too much further than that, but maybe can over the weekend. I'm no lua pro, though. I figured I'd get it in front of you first. Few things I'm confused about:

  1. 1003 is showing up in both the sidebar and tray window tables
  2. None of the other windows are showing up in either table
  3. 1003 appears to be a valid window id, so I'm not sure why nvim is complaining about an invalid window id.

I know windows is probably not your target platform, so let me know if I need to do any more testing to help with this.

And forgot to add: thanks so much for putting this together. Can't wait to switch to this from pdb and vimspector. I really like the UI you've put together.

Disable Statusline

Is it possible to disable the status line for windows DapUI makes?

local function setup_sidebar()

Like can you call set statusline=\ after the window is created?

or maybe something like:

au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "DAPUI_WATCHES" | set laststatus=0 | else | set laststatus=2 | endif

etc. for each win name (stacks, breakpoints, scopes, etc.)?

Feature Request: Option to Automatically Jump to Floating Elements

It would be great to be able to do something like this:

dapui.float_element('breakpoints', true) -- automatically jump

Or this:

dapui.float_element('breakpoints', { jump: true }) -- automatically jump

Rather than having to call the function twice:

dapui.float_element('breakpoints'); dapui.float_element('breakpoints')

Feature Request: Specify sidebar window configuration in config

Hi there,

Would be awesome if we could specify sidebar window configuration. In my opinion, variables should consume much more space than e.g. threads, so I'd like to specify this via config, though I can see that right now it just does splits without specifying the size. Version 2.0 of this feature would allow for persistence of manually resized (e.g. restarting the UI on the same file because I changed the code would not change the window layout which I have adapted in previous run to be well suited to debugging the current setup)

Thanks a ton for this awesome plugin!

REPL next to sidebar

I have a very wide screen and would prefer to have the REPL in a separate column next to the sidebar (with default contents). But it looks like right now that isn't possible-- you either use the tray or have to place the REPL inside a single-column sidebar.

Would you consider making it possible to use two columns?

Feature request: Show breakpoints as a pane

Hi,

This idea came out of mfussenegger/nvim-dap#185.

I think it would be very helpful to have a pane showing all active breakpoints. as far as I can tell this isn't available yet as an element. A desired solution would show me breakpoint file number and line and allow easy jumping to it, e.g. via enter/o key

local elements = {
  STACKS = "stacks",
  SCOPES = "scopes",
  REPL = "repl",
  WATCHES = "watches"
}

Cannot override map using lua configuration

Using the setup configuration to override default keymaps doesn't work for me.

require("dapui").setup({
  mappings = {..}

Let me know if there's any info I can provide to help you debug. Thanks!

Floating window doesn't appear to work as expected

The README states that to activate the floating window you call require("dapui").float_element(<element ID>). In the README an example element ID is stacks. So I execute require("dapui").float_element(stacks). This then prompts me for an element ID again, however, it seems to only take numbers, I tried using numbers 1-10 but nothing happened. My expectation is that by executing require("dapui").float_element(stacks) an additional prompt would not appear and instead just the floating window would.

Windows should have fixed buffers

It's possible to highlight a UI window (e.g. dap_stacks) and change the buffer displayed within. Such behaviour is forbidden in, say, NvimTree. I think it makes sense here, too.

dapui/util.lua:6: attempt to index local 'path' (a nil value)

I got error messages when starting nvim-dap (and "step over", ...):

Error executing vim.schedule lua callback: ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/util.lua:6: attempt to index local 'path' (a nil value)

nvim-dap-ui error

And more:
nvim-dap-ui errors

Despite the error messages, dap-ui works well except the "DAP Stacks" window:
nvim-dap-ui no_stacks

I could fix(?) them by adding the following line to the first of function util.pretty_name(path):

function M.pretty_name(path)
  if path == nil then return "" end
  -- ...

Or this to the first of function util.is_uri(path):

function M.is_uri(path)
  if path == nil then return false end
  -- ...

nvim-dap-ui fixed

My configs:

local dap = require("dap")

dap.adapters.rust = {
  type = "executable",
  attach = {pidProperty = "pid", pidSelect = "ask"},
  command = "lldb-vscode",
  env = {LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "YES"},
}

dap.configurations.rust = {
  {
    type = "rust",
    request = "launch",
    name = "lldb",

    program = function()
      local metadata_json = vim.fn.system("cargo metadata --format-version 1 --no-deps")
      local metadata = require("lib.json").decode(metadata_json)
      local target_name = metadata.packages[1].targets[1].name
      local target_dir = metadata.target_directory
      return target_dir .. "/debug/" .. target_name
    end,
  },
}

require("dapui").setup {icons = {expanded = "๏‘‹", collapsed = "๏‘Š"}}

My envs:

  • NVIM v0.5.0-dev+nightly-656-g2a1bc8657
  • lldb version 12.0.0
  • cargo 1.54.0-nightly (e51522ab3 2021-05-07)
  • rustc 1.54.0-nightly (ca82264ec 2021-05-09)
  • macOS 11.4 / MacBook Pro 2019

Thank you for the great extention!

Highlight changed variables

In VSCode debugger, when a variable's value changes, the whole thing gets highlighted, like in the picture below.
That would be a very nice enhancement to add imo.

image

`eval` window stays open

Hi! First of all, congratulations on the amazing plugin!

I just tried out the eval feature. Having the variable value in a floating window is great, but I can't close it easily.
I need to focus it (by clicking, or triggering eval a second time) and :q.

One would expect the window to close on cursor movement, except if it has been focused!

(also, the window is always on the top left corner of the screen... one would expect it to be under the cursor, but it's not a big deal)

What do you think?

Thank you for your fantastic work.

[Feature Request]: Have cursor jump to selectable variables in the scope window

In the scope window the only 'actionable' items are those that are expandable. It would be a small efficiency improvement if pressing 'j' or 'k' jumped to lines which are actionable. At the moment relative jumps is probably the fastest way but I feel like this would make variable inspection faster

An example in the picture would be if I press j, it would jump from line 7 to line 23. Everything in between is already visible and cant be expanded anymore.

I'm not sure if something like this is feasible as it would stop other things being possible e.g. yanking variables or something like that, but maybe this could be toggleable. Just an idea anyways.

Alternatively if could be a keymapping where jumps to next actionable etc.

Screenshot 2021-06-11 at 13 4206

Insert mode in repl window is not exited after debugging ends

The moment debugging stops all windows automatically close. If we are currently in insert mode in the REPL window (i.e step through the entire program (NOT IF .exit is executed)) we are thrown into insert mode in the code window.
Now the real problem is the fact that the stuff you accidentally inserted isn't undoable.
Don't know if this is a bug by neovim (im on v0.5.0-dev+1423-ge2d3ad7bc)
However i've managed to fix this by manually going into normal mode after the window closes. Inserting this

function M.on_close()
    local key = vim.api.nvim_replace_termcodes("<Esc>", true, false, true)
    vim.api.nvim_feedkeys(key, 'n', true)
end

into

function M.on_close()
here.

error at start

I'm geting the folowing error

Automatically opening the UI is deprecated.
You can replicate previous behaviour by adding the following to your config

local dap, dapui = require('dap'), require('dapui')
dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end
dap.listeners.before.event_terminated['dapui_config'] = function() dapui.close() end
dap.listeners.before.event_exited['dapui_config'] = function() dapui.close() end

To hide this message, remove the `open_on_start` settings from your config

Alternate mapping for mouse

Is there way to add mouse double click as additional mapping to expand selected item (so that we can use both Ret and 2Click for expand/collapse)?

Error executing vim.schedule lua callback: vim/shared.lua:423: s: expected string, got nil

Then rerunning a debugging run (dap.stop(), then restart), I always encounter an error. Re-opening nvim everytime is a bit laborious.

Error executing vim.schedule lua callback: vim/shared.lua:423: s: expected string, got nil
stack traceback:
        vim/shared.lua:423: in function 'trim'
        ...m/plugged/nvim-dap-ui/lua/dapui/elements/breakpoints.lua:30: in function 'render_breakpoints'
        ...m/plugged/nvim-dap-ui/lua/dapui/elements/breakpoints.lua:78: in function 'render'
        ...m/plugged/nvim-dap-ui/lua/dapui/elements/breakpoints.lua:100: in function 'refresh_breakpoints'
        ...m/plugged/nvim-dap-ui/lua/dapui/elements/breakpoints.lua:127: in function 'on_open'
        .../yingzhu/.vim/plugged/nvim-dap-ui/lua/dapui/windows.lua:33: in function 'open_wins'
        .../yingzhu/.vim/plugged/nvim-dap-ui/lua/dapui/windows.lua:61: in function 'open_sidebar'
        /Users/yingzhu/.vim/plugged/nvim-dap-ui/lua/dapui.lua:156: in function 'open'
        /Users/yingzhu/.vim/plugged/nvim-dap-ui/lua/dapui.lua:127: in function 'c'
        /Users/yingzhu/.vim/plugged/nvim-dap/lua/dap/session.lua:539: in function </Users/yingzhu/.vim/plugged/nvim-dap/lua/dap/session.lua:527>

Array elements in Locals are not automatically updated

image

Whenever I step over a line that changes the elements of an arrary, the values are not updated in the Locals sidebar.

This is only for elements within an array. All other locals like a normal integers are updated automatically.

Currently I have to close the drop down and open again to see the updates.

I am debugging C++ on NVIM v0.5.0-dev+nightly.

Highlight clarification

The screenshots in the readme look very appealing, however I am not able to reproduce them on my local setup. There are no discernible highlights out-of-the-box (see screenshot), and it is unclear how to configure them (if possible at all). The highlights in dapui.highlights don't seem to have any effect, or am I missing something? I am loading my colorscheme (gruvbox-material) prior to requiring dapui.
2021-04-11-140924_1440x479_scrot

Highlighting is very important here imo, since the naturally narrow windows clutter up very quickly (I artificially widened the above screenshot for clarity):
2021-04-11-141223_361x642_scrot

What is the canonical way to set these highlights? Maybe it is even possible to simply link to tree-sitter groups, such that tree-sitter aware colorschemes can benefit from this without cost?

Don't clear REPL when closing UI

When UI is toggled on, the REPL becomes cleared. It would be preferable to have the REPL be persistent.

When opening the REPL using :lua require("dap").repl.open() the REPL does not clear. It only clears when opening using :lua require("dapui").toggle()

Edit: It looks like :lua require("dap").repl.close() is what clears the REPL. Using that function closes the split and clears the history. But just closing the split with :q does not clear the history, such that when re-opening the contents will still be there.

So perhaps I should report this to nvim-dap instead.

Edit 2: Turns out you can call repl.close({ mode="toggle" }) to close the repl without clearing its contents. So this can be fixed within nvim-dap-ui. I'll put up a PR shortly in case this is something you'd be interested in accepting.

Watches not updated

Variables added to a watch are not automatically updated in the watch window. I have to go back to the watch window and re-add the variable for it to update.

Here is my configuration

require("dapui").setup()
require('dap-python').setup('~/miniconda3/envs/debugpy/bin/python')

If I add a watch variable to tmp in the following code, tmp stays at 0 throughout the loop rather than being incremented (see screenshot below).

for i in range(10):
    tmp = i
    print(tmp)

2021-07-26-123359_1904x1292_scrot

Create keymap to close floating window

First, I wanna thank you for the awesome plugin.
Screenshot_20210801_205517
As you can see in my screenshot, when my cursor is in a floating window, I must type :q to quit. When I use native LSP, they added keymap q to close the floating window more natural.
I can add mapping to vimrc like this:

autocmd FileType dapui_hover nnoremap <buffer> <silent> a :bdelete<cr>

But I think set buffer keymap in plugin's Float window is better.
Hope I can add that keymap to your plugin and it will be configurable:

  mappings = {
    close_floating = {"<Esc>", "q"},
  }

If you agree, I will create PR for this. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.