David-Kunz / jester

A Neovim plugin to easily run and debug Jest tests
The Unlicense
198 stars 12 forks source link

Integrate with rcarriga/nvim-dap-ui repl window? #9

Closed zach-wahrer closed 2 years ago

zach-wahrer commented 2 years ago

I'm really loving jester, so a huge thanks for all the work you've put into it. :-)

Basically, what I'd like to do is put jester's terminal output into the nvim-dap-ui repl window. All the other debug windows from the dap-ui work perfectly (stacks, breakpoints, scopes) with Jester, but the repl window stays blank. I've tried to figure out how to pipe the terminal output from jester into that window (running lua require"jester".debug({ terminal_cmd =}) with lots of different options, but none seem to work.

Any direction on how this might be possible? I can definitely rearrange the jester terminal window to fit the layout, but that cuts into the flow of coding, so I'd like to find an automated solution. Thanks again!

David-Kunz commented 2 years ago

Hi @zach-wahrer ,

Thanks a lot for this positive feedback, highly appreciated!

That's an interesting idea. The moment you debug something, I only start nvim-dap and don't have any control what's being done exactly, maybe there are some settings in nvim-dap?

Best regards, David

zach-wahrer commented 2 years ago

Thanks for the response, @David-Kunz! I tried playing around with the dap settings (with and without jester as an intermediary), and it still pops up in the separate terminal and not in the dap-ui repl. So I think as you noted, this issue is upstream. Thanks for pointing me in that direction. :-)

zach-wahrer commented 2 years ago

And I also just saw this: https://github.com/rcarriga/nvim-dap-ui/issues/88 , so perhaps this is actually something that is going to be added to nvim-dap-ui. :-)

David-Kunz commented 2 years ago

Perfect, thanks for the info! Let's see if they implement that feature.

mfussenegger commented 2 years ago

If I'm not mistaken this is controlled via the console option. If it's not set to integratedTerminal I think it would default to write the output to the repl

https://github.com/David-Kunz/jester/blob/e57340c0cb80d874a89bcb905bff4c44e49b5400/lua/jester/init.lua#L210

David-Kunz commented 2 years ago

Thanks for jumping in, @mfussenegger !

zach-wahrer commented 2 years ago

Thanks, @mfussenegger for pointing this out! Such an easy fix, now. :-) This worked perfectly for me:

vim.api.nvim_set_keymap(
    "n",
    "<leader>dj",
    "<cmd>lua require('jester').debug({dap = { console = ''}})<CR>",
    { noremap = true }
)