Skip to content

Conversation

@igorlfs
Copy link
Owner

@igorlfs igorlfs commented May 14, 2025

Closes #60,
Closes #18

An alternative to "adding a terminal window to the main window".

Allows the user to define a function that returns a window number for the main window to track (aka "follow"), overriding the tracking of the regular terminal.

Coupled with the option to hide the terminal for some adapters, allows a seamless experience for Go debugging when remote attaching with delve.

Config:

    opts = {
        windows = {
            terminal = {
                hide = { "delve" },
            },
            anchor = function()
                -- proof of concept, can be tweaked 
                local windows = vim.api.nvim_tabpage_list_wins(0)

                for _, win in ipairs(windows) do
                    local bufnr = vim.api.nvim_win_get_buf(win)
                    if vim.bo[bufnr].buftype == "terminal" then
                        return win
                    end
                end
            end,
        },
    },

Demo

dap-demo.mov

@231tr0n let me know if this suffices for your use case.

@231tr0n
Copy link

231tr0n commented May 14, 2025

Yup this works. Thanks @igorlfs

@igorlfs igorlfs marked this pull request as ready for review May 14, 2025 03:09
@igorlfs
Copy link
Owner Author

igorlfs commented May 14, 2025

Yup this works.

Nice, let me know if you find any other issues

@igorlfs igorlfs merged commit 499b3fa into main May 14, 2025
2 checks passed
@231tr0n
Copy link

231tr0n commented May 15, 2025

Yup this works.

Nice, let me know if you find any other issues

@igorlfs I finally got the time to look at this. Is it possible to attach a terminal to the nvim-dap-view ui itself with a new tab saying Terminal [T]?

@igorlfs
Copy link
Owner Author

igorlfs commented May 15, 2025

Is it possible to attach a terminal to the nvim-dap-view ui itself with a new tab saying Terminal [T]?

No, this feature was made specifically so we wouldn't have to venture into this route. I'll only support a "terminal view" if something like js-debug's node-terminal is standardized in the protocol. Having "custom views" is also out of question for now, as the anchor option should cover your use case. Is it lacking something? From my brief usage, it seemed like a perfect fit.

@igorlfs
Copy link
Owner Author

igorlfs commented May 15, 2025

But I was in a bit of a hurry to make this PR, I'll add some proper documentation for the README, highlighting the "Attach with delve" use case.

@igorlfs
Copy link
Owner Author

igorlfs commented May 16, 2025

But I was in a bit of a hurry to make this PR, I'll add some proper documentation for the README, highlighting the "Attach with delve" use case.

See d76741a

@igorlfs igorlfs deleted the feat/anchor branch May 22, 2025 00:56
@231tr0n
Copy link

231tr0n commented May 27, 2025

@igorlfs sorry for the delayed reply I can confirm the anchor function works perfectly for my usecase. Thank you soo much for adding it.

@igorlfs
Copy link
Owner Author

igorlfs commented May 27, 2025

@igorlfs sorry for the delayed reply I can confirm the anchor function works perfectly for my usecase.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Add a new terminal tab to open new terminal. bug: Terminal for delve adapter displayed with "below" split

3 participants