Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmdheight gets overridden to 1 upon nvim-dap-ui starts #108

Closed
Frederick888 opened this issue Jun 11, 2022 · 5 comments
Closed

cmdheight gets overridden to 1 upon nvim-dap-ui starts #108

Frederick888 opened this issue Jun 11, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@Frederick888
Copy link

I have cmdheight=2 as default and however nvim-dap-ui sets it to 1. I don't have this issue if I use nvim-dap without nvim-dap-ui.

My nvim-dap/-ui config:

" nvim-dap
if has('nvim')
  lua << EOF
    local dap, dapui = require('dap'), require('dapui')
    require('dap-go').setup()
    dapui.setup()
    vim.fn.sign_define('DapBreakpoint',          { text='', texthl='', linehl='debugBreakpoint', numhl='debugBreakpoint' })
    vim.fn.sign_define('DapBreakpointCondition', { text='', texthl='', linehl='debugBreakpoint', numhl='debugBreakpoint' })
    vim.fn.sign_define('DapStopped',             { text='', texthl='', linehl='debugPC',         numhl='debugPC' })
    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
EOF
  function! s:dap_ui_evaluate(expression) abort
    let escaped_expression = escape(a:expression, '"\')
    execute 'lua require("dapui").eval("' . l:escaped_expression . '")'
  endfunction
  command! -nargs=1 DapEvaluate  :call <SID>dap_ui_evaluate(<f-args>)
  nnoremap <silent> <F5>         :lua require('dap').continue()<CR>
  nnoremap <silent> <F17>        :lua require('dap').reverse_continue()<CR>
  nnoremap <silent> <leader><F5> :lua require('dap').run_to_cursor()<CR>
  nnoremap <silent> <F10>        :lua require('dap').step_over()<CR>
  nnoremap <silent> <F22>        :lua require('dap').step_back()<CR>
  nnoremap <silent> <F11>        :lua require('dap').step_into()<CR>
  nnoremap <silent> <F23>        :lua require('dap').step_out()<CR>
  nnoremap <silent> <F6>         :lua require('dap').pause()<CR>
  nnoremap <silent> <F9>         :lua require('dap').toggle_breakpoint()<CR>
  nnoremap <silent> <leader><F9> :lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
  nnoremap <silent> <F33>        :lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
  nnoremap <silent> <M-S-F9>     :lua require('dap').clear_breakpoints()<CR>
  nnoremap <silent> <M-S-F10>    :lua require('dap').terminate()<CR>
  nnoremap <silent> <leader>e    :lua require('dapui').eval()<CR>
  xnoremap <silent> <leader>e    <Cmd>lua require('dapui').eval()<CR>
  nnoremap          <leader>E    :DapEvaluate<space>
  autocmd  FileType dap-float    nnoremap <silent> q :q<CR>
  autocmd  FileType dap-repl     lua require('dap.ext.autocompl').attach()
endif

Neovim version:

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
@rcarriga
Copy link
Owner

Ah I see why this is happening, I'll have to tinker around to prevent this

@rcarriga
Copy link
Owner

Tried to find a way to handle this without just resetting the value but doesn't seem possible with how NeoVim handles resizing windows. Added a fix in latest commit to just reset after opening/closing the windows

@ByteDrummer
Copy link

When I toggle the UI several times with the latest version, I notice that the "DAP Watches" and repl split shrink if I have cmdheight=2. I'm assuming this bug is related.

@ByteDrummer
Copy link

Here's a recording of it:

@rcarriga
Copy link
Owner

This is not related AFAIK to the cmdheight fix but is due to the way the window sizing logic works. There can rounding issues. Although I haven't solved the underlying problem, you can use the reset argument to the open and toggle functions. Related issue #116

Also closing this issue as it's been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants