Skip to content

Integrate .gitpod.yml tasks into JetBrains IDEs #8338

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

Closed
wants to merge 1 commit into from
Closed

Conversation

felladrin
Copy link
Contributor

@felladrin felladrin commented Feb 21, 2022

Description

Integrate .gitpod.yml tasks into JetBrains IDEs.

Here's a summary of what it does:

  • Starts a service when the Backend IDE starts.
  • Fetches all running/closed tasks from Supervisor.
  • With the tasks, fetches all their related active terminals from Supervisor.
  • For each Supervisor terminal, a new IDE Shared Terminal is created and connected to Supervisor terminal via gp tasks attach <terminal>.
  • When a Thin Client (Frontend IDE) connects, the shared terminals to appear.

Related Issue(s)

Resolves #6525

How to test

Release Notes

Tasks defined on .gitpod.yml are now displayed in terminals from JetBrains IDEs when a user starts a workspace as it does on VS Code.

Known limitations

  • Shared terminals on Thin Client show only the last few lines of the history. But on the Backend IDE we can see the full history. This is currently hardcoded on JetBrains RemoteDev.
  • It's not possible to rename the shared terminal tabs programmatically, so all of them will be named "Local: Shared" until the user manually renames them by double-clicking the terminal tab. But JetBrains is refactoring it and soon we'll be able to rename shared terminals easily.
  • It's not possible to split shared terminals.
  • It's not possible to resize the terminal (max line witdth) from Thin Client. Resize happens only if terminal width is changed on the Backend IDE.
  • Only one shared terminal gets properly connected. So if we have 4 Gitpod Tasks, 4 terminals will be displayed on Thin Client during the startup, but only one of them will be correctly showing the content of what is running in the Backend IDE.

Documentation

None.

@mustard-mh
Copy link
Contributor

mustard-mh commented Apr 13, 2022

I cannot see full terminal content, is it correct (like we cannot do more progress now)?

As PR description said 👍

Shared terminals on Thin Client show only the last few lines of the history. But on the Backend IDE we can see the full history. This is currently hardcoded on JetBrains RemoteDev.

Origin Terminal in Thin Client ❌ Main Window ✅ Run gp tasks attach in Thin Client ✅
image image image

@felladrin
Copy link
Contributor Author

felladrin commented Apr 13, 2022

I cannot see full terminal content, is it correct (like we cannot do more progress now)?

Thanks for reviewing it, @mustard-mh!
Unfortunately, there's nothing else we can do about it at this moment. JetBrains Team confirmed the terminals's history size on Thin Client is currently hardcoded within Shared Terminals feature and there's no workaround available. (Internal Discussion)

I also tried opening a new terminal everytime a new Thin Client connection is created, but it didn't help (and brought some other issues like the quadrupled characters on Thin Client).

mustard-mh
mustard-mh previously approved these changes Apr 13, 2022
Copy link
Contributor

@mustard-mh mustard-mh left a comment

Choose a reason for hiding this comment

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

/hold

Test good

Why we need codewithme plugin added if GitpodTerminalService not use it? is it a dependency of other plugins?

@felladrin
Copy link
Contributor Author

Why we need codewithme plugin added if GitpodTerminalService not use it? is it a dependency of other plugins?

Nice catch! I agree it's not clear in the code, but we need to add codewithme as a dependency to be able to import/use com.jetbrains.rdserver.terminal.BackendTerminalManager on GitpodTerminalService. (Internal Discussion)

@akosyakov
Copy link
Member

akosyakov commented Apr 14, 2022

  • I opened this PR with prev envs, but it showed me only 2 terminals instead of 4:

Screenshot 2022-04-14 at 10 52 37

  • If i type exit terminal does not get closed and terminal remains unusable. The terminal should close automatically if an underlying task is closed.
  • When I click on close terminal in JetBrains and an underlying task terminal is not closed.
  • If I resize a terminal to change its width an underlying shell does not get resized properly.


backendTerminalManager.shareTerminal(shellTerminalWidget, supervisorTerminal.alias)

shellTerminalWidget.executeCommand("gp tasks attach ${supervisorTerminal.alias}")
Copy link
Member

Choose a reason for hiding this comment

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

we are loosing control with that, no? We need to propagate proper UI sizes to terminal, close it then a user closes, and close a frontend terminal then an underlying terminal is closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. But I can't get back using CloudTerminalRunner until #CWM-5523: Support CloudTerminalRunner mirroring to thin client is resolved. (Internal Discussion)

There are like 5x more issues when using CloutTerminalRunner in place of go tasks attach.

Maybe the best solution for this changes is creating a custom IntelliJ Tool Window, as suggested by JetBrains Team, but that would require a totally different implementation/PR.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe the best solution for this changes is creating a custom IntelliJ Tool Window, as suggested by JetBrains Team, but that would require a totally different implementation/PR.

Agree it is better to wrap up what we have and tackle other things in followed up.

It should at least open all task terminals, not like in #8338 (comment). Fixing closing behaviour will be good but let's do it with another PR too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm now trying to use backendTerminalManager.createNewSharedTerminal (as when I use it, all the terminals are created accordingly and displayed on the Thin Client), but the consequence is that there's no easy way to find which terminal was created by this method.
I'm looking into a way to find each terminal and run gp attach in each. (b82c26e)

@felladrin felladrin marked this pull request as draft April 14, 2022 10:41
@felladrin
Copy link
Contributor Author

Setting it back to Draft while I analyze the last reviews comments.

@felladrin
Copy link
Contributor Author

felladrin commented Apr 26, 2022

@mikenikles
Copy link
Contributor

We'll get back to it when Shared Terminals feature become more stable.

Is there an issue in this repo where you track this? I'd like to subscribe to get notified when this feature is available as the current functionality of showing a single terminal when .gitpod.yml defines 5 terminals isn't developer-friendly and adds friction.

@felladrin
Copy link
Contributor Author

felladrin commented Aug 4, 2022

We'll get back to it when Shared Terminals feature become more stable.

Is there an issue in this repo where you track this? I'd like to subscribe to get notified when this feature is available as the current functionality of showing a single terminal when .gitpod.yml defines 5 terminals isn't developer-friendly and adds friction.

Thanks for asking! We've implemented it, but the feature is only available when Gitpod Settings has the "Use Latest (Unstable)" option checked. We're improving it before making it available for Stable IDEs.

Here's the PR, for reference:

@mikenikles
Copy link
Contributor

Awesome, thanks for the update Victor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build the tasks command API (.gitpod.yml) into JetBrains integration
6 participants