-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support integrated terminal #6508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes make sense and code-wise looks good to me
Could someone please test whether it works?
I'll test it now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works correctly for me :)
@tolusha please clean up the history and merge 🚀 |
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
047bb2b
to
c7fa835
Compare
@@ -368,14 +368,19 @@ export class DebugSession implements CompositeTreeElement { | |||
} | |||
|
|||
protected async runInTerminal({ arguments: { title, cwd, args, env } }: DebugProtocol.RunInTerminalRequest): Promise<DebugProtocol.RunInTerminalResponse['body']> { | |||
return this.doRunInTerminal({ title, cwd, shellPath: args[0], shellArgs: args.slice(1), env }); | |||
const terminal = await this.doCreateTerminal({ title, cwd, env }); | |||
terminal.sendText(args.join(' ') + '\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akosyakov This part is causing us issues, but it is also a bad thing to do to send un-escaped commands to a shell like this. IIUC, the idea is that we want to reuse a shell widget to display the output. But in this case it seems like we try to reuse actual shell processes, instead of reusing widgets.
Since this is broken for us, I will start trying to look at what is required to reuse shell widgets, do you have any opinions and/or pointers for me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to open an issue, will do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is VS Code implementation:https://github.com/microsoft/vscode/blob/43e3581aa635406ada2d8138d7ee242ddabefc1c/src/vs/workbench/contrib/debug/node/terminals.ts#L79
We can reuse it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this, but it may indeed be the easiest solution here. Why would we convert a nice array of arguments into one big escaped string though? We can spawn processes directly from a command + arguments. Do debug adapters expect that their clients will provide variable-expansion or other shell-specific behaviors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking more into it, we do want to use shells. Things like running node
without specifying a full path wouldn't work otherwise. Not sure we want to try to always reuse the same shell process though. In VS Code they check before reusing a shell that it doesn't have child processes running, this seems sketchy. I would rather make sure the shell dies when the command is executed, and reuse the widget if process is dead. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't get it. Here is a solution, which we can copy and fix the issue, and then focus on something else instead of spending time reinventing our solution. Plus it makes it easier to catch up later if there are some bug fixes.
Not sure we want to try to always reuse the same shell process though. In VS Code they check before reusing a shell that it doesn't have child processes running, this seems sketchy. I would rather make sure the shell dies when the command is executed, and reuse the widget if process is dead. WDYT?
Sorry, I don't know how it is related to escaping. We start a new terminal each time for now. Please file a new issue if there is a mismatch from user perspective with steps how to reproduce in Theia and VS Code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But apparently VS Code has the same issue when running the same command, user can pollute the shell that the extension tries to send commands to... Ok.
Signed-off-by: Anatoliy Bazko abazko@redhat.com
Reference issue
#6103
What it does
It creates terminal in a proper way.
How to test
Review checklist
Reminder for reviewers