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

Support integrated terminal #6508

Merged
merged 1 commit into from
Nov 8, 2019
Merged

Support integrated terminal #6508

merged 1 commit into from
Nov 8, 2019

Conversation

tolusha
Copy link
Contributor

@tolusha tolusha commented Nov 7, 2019

Signed-off-by: Anatoliy Bazko abazko@redhat.com

Reference issue

#6103

What it does

It creates terminal in a proper way.

How to test

  1. Add VS Code Python extension https://github.com/Microsoft/vscode-python/releases/download/2019.5.18875/ms-python-release.vsix
  2. Open any python file
  3. Add debug configuration
{
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
  1. Add some breakponits
  2. Start debugging
  3. Check that console is opened and all debug features work well

Review checklist

Reminder for reviewers

@tolusha tolusha added vscode issues related to VSCode compatibility debug issues that related to debug functionality labels Nov 7, 2019
@tolusha tolusha self-assigned this Nov 7, 2019
Copy link
Member

@akosyakov akosyakov left a 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?

@vince-fugnitto
Copy link
Member

changes make sense and code-wise looks good to me

Could someone please test whether it works?

I'll test it now :)

Copy link
Member

@vince-fugnitto vince-fugnitto left a 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 :)

@akosyakov
Copy link
Member

@tolusha please clean up the history and merge 🚀

Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
@tolusha tolusha merged commit 0327a4d into master Nov 8, 2019
@tolusha tolusha deleted the ab/integratedTerminal branch November 8, 2019 09:11
@@ -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');
Copy link
Member

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?

cc @marcdumais-work

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@paul-marechal paul-marechal Dec 4, 2019

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?

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Terminals are reused when handling runInTerminal requests:

theia-vscode-python-ext

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants