-
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
Initial contribution of @theia/external-terminal #9186
Initial contribution of @theia/external-terminal #9186
Conversation
ff65621
to
5d61df6
Compare
I'll file the appropriate CQs for the changes. Edit: added a link in the pull-request description: CQ. |
packages/terminal-external/src/electron-browser/terminal-external-preference.ts
Outdated
Show resolved
Hide resolved
The CQ has been approved 👍:
|
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.
LGTM, works well on Windows!
I just have minor comments.
packages/terminal-external/src/electron-browser/terminal-external-preference.ts
Outdated
Show resolved
Hide resolved
5d61df6
to
e6af6d0
Compare
Please rebase on latest master, I just merged #9169 :) |
e6af6d0
to
3ace0ae
Compare
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.
Seems to be working for me. Some minor comments on the code and some even more minor comments on the comments. I do wonder why the name terminal-external
rather than external-terminal
. The former sounds like it's things that happen outside of the terminal, rather than terminals that appear outside the application.
packages/terminal-external/src/electron-browser/terminal-external-contribution.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-browser/terminal-external-contribution.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-browser/terminal-external-preference.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-node/terminal-external-service.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-node/terminal-external-service.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-node/terminal-external-service.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-node/terminal-external-service.ts
Outdated
Show resolved
Hide resolved
} else if (process.env.DESKTOP_SESSION === 'kde-plasma') { | ||
r('konsole'); | ||
} else if (process.env.COLORTERM) { | ||
r(process.env.COLORTERM); |
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.
This seems to fail for me (on RedHat Linux) at this branch. It seems that the COLORTERM
in my environment is truecolor
, but when that's used to spawn a terminal, the openTerminal
request fails.
root ERROR Request openTerminal failed with error: spawn truecolor ENOENT Error: spawn truecolor ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
VSCode suffers the same failure, though, so perhaps we shouldn't expect to do better, and once I set the preference to the correct path, I do get a new terminal as expected.
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.
https://www.gnu.org/software/gettext/manual/html_node/The-TERM-variable.html
Not sure what the actual semantic of TERM
and COLORTERM
is, but IIUC one can use them to tell programs like xterm
to configure some kind of feature support, or in the case of COLORTERM
it would be set by the terminal application itself for processes spawned by it to detect features like truecolor
support. So trying to use it to get an executable sounds weird, given that?
Being as bad as VS Code is acceptable, but if someone is able to tell for sure that this is bogus then we can fix that logic.
@colin-grant-work I believe it was mainly to group terminal functionality together on the filesystem: I agree however that |
On a side note, I ❤️ the desktop background in the screencasts in the description. |
3ace0ae
to
4c4a7df
Compare
5f7d24a
to
a3aa8d9
Compare
Thank you for such a detailed review, super appreciate it. I updated the PR to address your comments 👍 Side note: my razer desktop background 😄 |
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.
The updated changes look good to me, and are well described.
We can always update the extension in the future to add additional features, and/or refactorings if necessary.
The changes also work well, I verified on macOS and Linux 👍
packages/terminal-external/src/electron-browser/terminal-external-contribution.ts
Outdated
Show resolved
Hide resolved
packages/terminal-external/src/electron-browser/terminal-external-contribution.ts
Outdated
Show resolved
Hide resolved
packages/external-terminal/src/electron-node/linux-external-terminal-service.ts
Outdated
Show resolved
Hide resolved
packages/external-terminal/src/electron-browser/external-terminal-preference.ts
Outdated
Show resolved
Hide resolved
packages/external-terminal/src/electron-browser/external-terminal-preference.ts
Show resolved
Hide resolved
packages/external-terminal/src/electron-browser/external-terminal-contribution.ts
Outdated
Show resolved
Hide resolved
packages/external-terminal/src/electron-browser/external-terminal-contribution.ts
Outdated
Show resolved
Hide resolved
packages/external-terminal/src/electron-node/linux-external-terminal-service.ts
Outdated
Show resolved
Hide resolved
a3aa8d9
to
8f08be0
Compare
The following commit adds a new extension `@theia/terminal-external`. The extension adds support for spawning external terminals from Electron applications. + Supports opening native terminals by calling `Open New External Terminal` from the command palette. + The commit contributes the following preferences: - `terminal.external.windowsExec` - `terminal.external.osxExec` - `terminal.external.linuxExec` to allow users to customize the desired terminal application to run on their current OS. Co-authored-by: Paul <paul.marechal@ericsson.com> Co-authored-by: vince-fugnitto <vincent.fugnitto@ericsson.com> Signed-off-by: Duc Nguyen <duc.a.nguyen@ericsson.com>
8f08be0
to
db38e00
Compare
@kittaakos Thanks for the review! Just wanted to clarify that this extension targets Electron applications only. Other than that, I updated the PR to address your comments. |
👍 Can we enforce it? I am curious if this is something Theia can do. What happens when a downstream adds the new |
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.
Very nice! Thank you for the new feature
I believe adding the extension to a browser app won't break anything, it simply will just be a no-op. |
Of course, you're right. Thank you! theia/packages/external-terminal/package.json Lines 14 to 17 in db38e00
|
I'll merge the pull-request tomorrow so it can be added to the upcoming release. Thank you for the work @dukengn 👍 |
What it does
@theia/external-terminal
. The extension adds support for spawning external terminals from Electron applications. In the future, the extension can be extended to support features such as spawning external terminals during debug sessions.(Browser applications should not pull this extension).
Checklist for merging:
Command:
Open New External Terminal
from the command palette.Preferences:
terminal.external.windowsExec
terminal.external.osxExec
terminal.external.linuxExec
to allow users to customize the desired terminal application to run on their current platform.
Exec
preference of other OS than the current one won't have any effect. (i.e: ChangingosxExec
while running on Windows doesn't have any effect).How to test:
exec
of host OS is displaying the correct terminal.Calling command
Open New External Terminal
has different behaviors, depending on the current workspace status:No workspaces opened and no current active editor -> Spawn the terminal at the user home directory.
no-ws-no-editors.mp4
No workspaces opened but has an active editor -> Spawn the terminal at the parent folder of the active editor file.
no-ws-active-editor.mp4
Only one workspace opened -> Spawn the terminal at the root of the current workspace.
singleWS.mp4
Multi-root workspace opened -> Displays a quick pick to let users choose which workspace to spawn the terminal.
multiWS.mp4
Review checklist
Reminder for reviewers
Signed-off-by: Duc Nguyen duc.a.nguyen@ericsson.com