-
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
ask user to terminate or restart a task if it is active #6668
Conversation
5969bed
to
4c5e5c6
Compare
@elaihau Is it aligned with VS Code UX? i.e. if task is finished and then started again the same terminal will be used To resolve #5269 we should print to the terminal like in #5269 (comment). Would it happen with this PR? |
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.
@elaihau
I tested your changes and noticed that the difference with VS Code behavior is:
- VS Code hides the bottom panel when user selects
Terminate Task
- another terminal widget is used if a task is completed and then started again (the current PR behavior)
Is it under the scope of the current PR?
It's not critical for me - just let you know the difference.
} | ||
this.messageService.info(`The task \'${taskName}\' is already active`, 'Terminate Task', 'Restart Task').then(actionTask => { | ||
if (actionTask) { | ||
this.taskServer.kill(taskId); |
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 it makes sense to use the corresponding method for terminating a task, this one handles errors
No what you described here is not implemented in this PR. We have a separated GH issue for it #5332 And the features of
are controled by the |
@RomanNikitenko thank you for the review ! I noticed that too :) But that's just my opinion ... I should follow the vscode behavior. And if users are unhappy someone can file a GH issue :)
Yes I can change my PR to follow this vscode behaviors. |
} | ||
} | ||
|
||
private async doRunTask(task: TaskConfiguration, option?: RunTaskOption): Promise<TaskInfo | undefined> { |
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.
Can we have protected
modifier here?
I think it will be more flexible for cases when some class extends TaskService
From this point of view also would nice to have at least protected
restartTask
method.
For example, at the moment attach
method is public
and it's possible to override this logic, provide own logic.
restartTask
logic is relative to it.
wdyt?
Comparing VSCode and Theia Suggestion: Would it be nice to put the message "... terminated by signal SIGHUP" at the end of the trace in the terminal and/or popping up a dialog to show the warning. In this case, the end-user would see in the terminal he/she stops the task while keeping the terminal view available! |
I just noticed something. when you select the "Terminate task", the terminal stays OK |
I don't see the warning following your procedure. |
@lmcbout I'd argue it's an enhancement to the current behavior. When we add support to display information regarding the task in the terminal #5332 we can also support displaying the exit message. |
4c5e5c6
to
dc75955
Compare
@lmcbout Thank you for the feedback |
@RomanNikitenko I resolved your comments and patched the code. |
@elaihau thanks for the explanation!
Please make sure to create issues for all missing features to make progress visible for others. |
const parent = terminal.parent; | ||
terminal.close(); | ||
if (actionTask === 'Terminate Task' && parent && parent.id === BOTTOM_AREA_ID) { | ||
parent.hide(); |
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 behavior can be improved for case when user has a few running tasks.
So if user terminates one task, but another task is running - output for second task should be displayed, we shouldn't hide the bottom area.
I don't mind to improve the behavior in another PR, up to you.
@elaihau |
Just tested the latest commit dc75955 |
dc75955
to
4d8dfd7
Compare
@RomanNikitenko I refactored the code to add Also I fixed the bug @lmcbout and @RomanNikitenko found. With the most recent change, the bottom panel wouldn't be hidden if there are other terminals open. |
There are still an error with the bottom panel.
|
Question: |
In order to support such a feature, we'd have to extend the theia/packages/core/src/browser/shell/application-shell.ts Lines 1605 to 1625 in d5c8110
|
Vincent's correct. Theia always spawn the terminal at the bottom panel. And we will need change the interface to include an option that controls the area that terminal is expected to be spawned. |
I think it should be another issue. We can ignore it for now. Don't think a user will move it. |
4d8dfd7
to
52063cb
Compare
In the latest patch I removed the code that closes the terminal & hides the panel. Also, Anton's review comments are addressed. Thank you all the for the feedback ! |
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.
code-wise it looks good, there are couple minor comments about control flow, please have a look
I've not had time to try it out, please rely for testing on other reviewers.
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 tested the functionality and it worked as intended 👍
52063cb
to
cd8a4c6
Compare
Thank you for the review Anton and Vincent ! Comments are resolved. |
1bad617
to
8ff506f
Compare
With changes in this pull request, Theia offers users the flexibility of terminating or restarting a task, if the user tries to run a task that is actively running. This pull request resolves eclipse-theia#6618 (comment) Signed-off-by: Liang Huang <liang.huang@ericsson.com>
8ff506f
to
dde9bac
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.
I'm happy with the latest changes :)
I tested the changes after last update and I can see the following behavior for the For
For
May be it makes sense to replace the gif in the PR description by gif which reflects the actual behavior. Also I tested for So I run I believe that the problem is not related to the current PR changes, something wrong with running
@elaihau |
@RomanNikitenko Yes I can reproduce the bug you described with NPM extension. There is something going wrong with the way that we search tasks from the cached data. Please feel free to file a GH issue. If you don't already have a PR for it, I can take a look at it tomorrow. |
@RomanNikitenko I created #6715 and will merge this one. Thanks ! |
With changes in this pull request, Theia offers users the flexibility of terminating or restarting a task, if the user tries to run a task that is actively running.
This pull request resolves #6618 (comment), and resolves #5269
Signed-off-by: Liang Huang liang.huang@ericsson.com
How to test
Review checklist