Replies: 3 comments 1 reply
-
Thank you @ckipp01 for opening this discussion. I never heard about this request before and it is an interesting one. According to the spec, it is a reverse request, so it is sent by the debug server (Bloop or sbt) to the debug client (VS Code or nvim) for the client to start the debuggee in a terminal. It solves the problem of color support, as you mentionned, but also it makes it possible for the debuggee process to read inputs from the user. That would be really nice to have, so yes I think it is worth looking into it. One thing that is not clear to me is how the debug server decides if it should start the debuggee itself or if it should send a In terms of implementation there may be one difficulty: Currently the debug server needs to read the socket address of the the debuggee in the first outputed line of the process:
But I think it is not possible to connect to a started process and to read its old output. As an alternative the debugger can find an available port and assign it to the debuggee. |
Beta Was this translation helpful? Give feedback.
-
I think it should sort of rely on the client to tell it or not? I guess in the Metals scenario I'd expect something like this? sequenceDiagram
dap client->>+metals: I want to runInTerminal
metals->>+debug server: forwards the request with a flag or something
debug server->>+debug server: starts up
debug server->>+dap client: based on value passed in either sends runInTerminal request or not
debug server ->dap client: normal communication continues
Maybe I'm misunderstanding, but I sort of just thought it was a switch, like the debug server shoots the |
Beta Was this translation helpful? Give feedback.
-
I wonder I wonder if we could add
For VS Code that seems to be set in |
Beta Was this translation helpful? Give feedback.
-
So digging around I think the answer is yes, in theory it could be supported, but it's not currently. However, I wanted to check to see if that's the case or if this has been explored at all yet during development.
Some back story
So the context for this is current for some clients that utilize Metals to run/test/debug can't support colors in the debug console. When we first hit on this I added in a setting that can be used that just strips the color. This is most relevant when you are running tests. This works fine, but as you can imagine the output then in the dap console in a client that doesn't support color looks like this:
Instead of the nice colors you get in the terminal or in a console like VS Code has that supports colors:
I started to look into how I could better support colors in nvim-metals which uses nvim-dap and when speaking to the
nvim-dap
maintainer the topic ofRunInTerminal
came up. This would cause the output to be in the integrated terminal of Neovim for example (or other editor that supports integrated terminals) and the color codes would be correctly interpreted.The debug console vs RunInTerminal
I'm still digging into this a bit, but from my understanding when a client says that it supports
supportsRunInTerminalRequest
during init theRunInTerminalRequest
request can be used which will then start an integrated or external terminal session and then everything following will be sent there by the client instead of the debug console.Taken from the overview page
Do you have any idea if there would be limitations in supporting this, or has this been looked into at all yet?
Beta Was this translation helpful? Give feedback.
All reactions