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

feat(dap)!: support integrated terminals (io in neovim) #877

Merged
merged 9 commits into from
Jul 27, 2023

Conversation

Jint-lzxy
Copy link
Collaborator

@Jint-lzxy Jint-lzxy commented Jul 19, 2023

Recent updates to nvim-dap made integrated terminals possibe right inside Neovim. This PR implemented basic support for this feature, but it's still necessary to adjust the settings of each debugger to correctly redirect stdio to the specified terminal (inside Neovim). More info: dap-terminal.

I'm not that familiar with other debuggers so I only adjusted the settings for codelldb (AFAIK lldb-vscode has zero support for IO redirection). Someone who understands these other debuggers could help make several changes before merging :) Any help will be appreciated!

Aditionally, K (responsible for require('dapui').eval()) will be set as a buffer-local keymap (mode: n|v) when a session initiates. We may need to document this in the Wiki.

Related: #416, #440, #592

@Jint-lzxy Jint-lzxy force-pushed the feat/dap-integrated-terminal branch 2 times, most recently from a9f1103 to 3f24b6f Compare July 19, 2023 17:54
@ayamir
Copy link
Owner

ayamir commented Jul 20, 2023

image

It's ok for codelldb 👍

@ayamir
Copy link
Owner

ayamir commented Jul 20, 2023

image

Works for debugpy.

@ayamir
Copy link
Owner

ayamir commented Jul 20, 2023

delve and lldb-vscode doesn't support this feature.

mfussenegger/nvim-dap#763
mfussenegger/nvim-dap#458 (comment)

@Jint-lzxy
Copy link
Collaborator Author

Jint-lzxy commented Jul 20, 2023

@ayamir vscode-go seems to support that but this require users to compile the corresponding executables themselves.

EDIT: Just noticed that Mason has a registry entry go-debug-adapter.

@Jint-lzxy
Copy link
Collaborator Author

35ec0f0

@Jint-lzxy
Copy link
Collaborator Author

Doesn't work on my machine...

Hmmm maybe open an issue upstream at nvim-dap? I'm not that familiar with delve so probably can't help with this :

The document indicates that setting console = "integratedTerminal" is supported 🤔

@ayamir
Copy link
Owner

ayamir commented Jul 20, 2023

Doesn't work on my machine...
image
VSCode is ok.
image

@ayamir
Copy link
Owner

ayamir commented Jul 20, 2023

Hmmm maybe open an issue upstream at nvim-dap?

mfussenegger/nvim-dap#987

@Jint-lzxy Jint-lzxy force-pushed the feat/dap-integrated-terminal branch from 1ab02c9 to 81c022b Compare July 21, 2023 09:32
@CharlesChiuGit
Copy link
Collaborator

sorry for the late reply, quite busy these couple weeks. i'll review this pr on following next week days.

@Jint-lzxy
Copy link
Collaborator Author

sorry for the late reply, quite busy these couple weeks. i'll review this pr on following next week days.

No worries and no hurry! Review this whenever it's convenient for you 😄

Copy link
Collaborator

@CharlesChiuGit CharlesChiuGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
圖片

But I don't know how to toggle to dap terminal tho

@Jint-lzxy
Copy link
Collaborator Author

But I don't know how to toggle to dap terminal tho

@CharlesChiuGit Move ur cursor to the buffer named [dap-terminal] <profile-name> (bottom left corner), enter insert mode and use that like a normal terminal (stdin and stdout are connected to that buffer if supported)

@CharlesChiuGit
Copy link
Collaborator

I only get this after I press <F6> to open terminal?

圖片

didn't see the dap-terminal buffer.

@Jint-lzxy
Copy link
Collaborator Author

didn't see the dap-terminal buffer.

Hmm that's strange. The effective component is (dapui):

{
	elements = {
		{ id = "console", size = 0.55 },
		{ id = "repl", size = 0.45 },
	},
	position = "bottom",
	size = 0.25,
},

Restart Neovim and sync those plugins to see if this helps?

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Jul 24, 2023

aha, I accidentally removed that part. Now it's working! tks!

圖片

@CharlesChiuGit
Copy link
Collaborator

is this pr gd to go?

@Jint-lzxy
Copy link
Collaborator Author

Currently waiting for mfussenegger/nvim-dap#987, cause I'm not sure if Go-related stuffs are good to go yet.

@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Jul 27, 2023

hmmm, the author just closed the issue as not planned.

@Jint-lzxy
Copy link
Collaborator Author

hmmm, the author just closed the issue as not planned.

Yeah that's indeed a tricky one. I'm drafting a new release note and will briefly cover this. I will merge this once Im done ;)

@Jint-lzxy Jint-lzxy merged commit a961024 into main Jul 27, 2023
4 checks passed
@Jint-lzxy Jint-lzxy deleted the feat/dap-integrated-terminal branch July 27, 2023 09:28
singlemancombat pushed a commit to singlemancombat/nvim-config that referenced this pull request Jul 27, 2023
* feat(dap)!: support integrated terminals (io in neovim)

* fix(dap): correct event callback

* feat(dap): setup keymaps correctly

* fix CI

fix variable naming

* adjust dapui

* feat(dap): support debugpy integrated terminal io.

* support vscode-go and misc changes

* fix CI

* fixup dap utils

---------

Co-authored-by: ayamir <lgt986452565@gmail.com>
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.

None yet

3 participants