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 presentation.reveal and presentation.focus in task config #6814

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Jan 3, 2020

  • show the terminal if presentation.reveal = "always",

  • do not show the terminal if presentation.reveal = "never",

  • when presentation.reveal = "silent", show the terminal only if errors are found from the task output by the parser

  • when users start a task that is already active, put focus on the terminal if presentation.focus = true, or reveal the terminal if presentation.reveal = "always"

Signed-off-by: Liang Huang liang.huang@ericsson.com

How to test

  1. Open a workspace and add some tasks
  2. Try adding "presentation" into the task config, and see if getting any content assist.
  3. Verify the following scenarios:
    3.1 adding "presentation": { "reveal": "always", "focus": false } to task config shouldn't change the behavior of Theia
    3.2 having "presentation": { "reveal": "never", "focus": false } in task config should leave the terminal for the task not-focused
    3.3 adding "presentation": { "reveal": "never", "focus": false } in a long running task, start the long running task, and start it one more time - the terminal should not be activated throughout all steps
    3.4 adding "presentation": { "reveal": "never", "focus": true }, or "presentation": { "reveal": "always", "focus": false } in a long running task, and try the rest of 3.3 - the terminal should have the focus when presentation.focus === true, while it should just be revealed and not have the focus if presentation.focus === false.
    3.5 adding "presentation": { "reveal": "silent", "focus": false } in a task, run the task, if the task has no problem matcher defined, or finishes without having errors (warnings and infos are not considered errors), the terminal should not get focus
    3.6 Replicate 3.5 with a task whose problem matcher finds errors from the task output - the terminal should get focus immediately after the first error is found.

Review checklist

@vince-fugnitto
Copy link
Member

@elaihau for some reason the ECA won't validate the email, I cannot restart it on my end.

@elaihau
Copy link
Contributor Author

elaihau commented Jan 3, 2020

@elaihau for some reason the ECA won't validate the email, I cannot restart it on my end.

yea I cannot do it from my side either. I changed the email back to the ericsson email address (which I temporarily don't have the password for), recreated the pull request, and it still failed.

Also looks like ECA in this pr is looking at #6812 , although it has been closed.

Screenshot from 2020-01-02 20-49-38

@akosyakov akosyakov added tasks issues related to the task system vscode issues related to VSCode compatibility labels Jan 3, 2020
@elaihau elaihau force-pushed the Liang/focus_reveal branch 2 times, most recently from 8fad530 to 944a538 Compare January 4, 2020 20:36
@elaihau elaihau force-pushed the Liang/focus_reveal branch 2 times, most recently from 0933055 to efd6cbd Compare January 7, 2020 02:24
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.

logic-wise it looks good now, it would be good if someone does double testing

@elaihau
Copy link
Contributor Author

elaihau commented Jan 7, 2020

Thank you Anton !

@vince-fugnitto
Copy link
Member

logic-wise it looks good now, it would be good if someone does double testing

@lmcbout do you mind testing the functionality of the pull request?

@lmcbout
Copy link
Contributor

lmcbout commented Jan 7, 2020

Testing with theia/packages/task/test-resources

According to the section "How to test" above
Test 3.4: { "reveal": "never", "focus": true } where is the focus after restarting the long task !!!
Should we keep focus on the terminated task !! Who has the focus ?

Test 3.5:
Add the following in the long running task

   if [ $i -gt 5 ]
   then
     echo ">5"
     ls | bogus_command
     echo "Jacques: $? "
     exit 5
   fi
==> This return the following but the terminal does not get the focus
>5
./task-long-running: line 11: bogus_command: command not found
ls: write error: Broken pipe
Jacques: 127 

Should the terminal get the focus here ?

@vince-fugnitto
Copy link
Member

@lmcbout

Test 3.4: { "reveal": "never", "focus": true } where is the focus after restarting the long task !!!
Should we keep focus on the terminated task !! Who has the focus ?

The terminal is focused, just simply not revealed due to reveal: never.

Test 3.5:

Can you confirm the behavior of your test case in VS Code?

@lmcbout
Copy link
Contributor

lmcbout commented Jan 7, 2020

@vince-fugnitto
Can you confirm the behavior of your test case in VS Code?

When running the test 3.5 with VSCode, the terminal opens when the task returns

@elaihau
Copy link
Contributor Author

elaihau commented Jan 8, 2020

Test 3.5:
Add the following in the long running task

   if [ $i -gt 5 ]
   then
     echo ">5"
     ls | bogus_command
     echo "Jacques: $? "
     exit 5
   fi
==> This return the following but the terminal does not get the focus
>5
./task-long-running: line 11: bogus_command: command not found
ls: write error: Broken pipe
Jacques: 127 

Should the terminal get the focus here ?

You are right @lmcbout . I checked the code in the debugger and found vscode checks the exit code of the task as well. I will fix it . Thank you !

@elaihau
Copy link
Contributor Author

elaihau commented Jan 8, 2020

@lmcbout the latest patch takes the exitCode into consideration as well

- show the terminal if presentation.reveal = "always",
- do not show the terminal if presentation.reveal = "never",
- when presentation.reveal = "silent", show the terminal only if errors are found from the task output by the parser

- when users start a task that is already active, put focus on the terminal if presentation.focus = true, or reveal the terminal if presentation.reveal = "always"

Signed-off-by: Liang Huang <liang.huang@ericsson.com>
@lmcbout
Copy link
Contributor

lmcbout commented Jan 8, 2020

Tested the exit code: works fine as long as the task takes time before exiting.
It seems if the exit or crash occurs to fast, the focus is not put on the terminal. For example, created a task that does not exist, the task terminates before the terminal is being registered, so the focus does not get to the terminal.
Ex: Add the following in task.json (It does not exist)

{
            "label": "Jacques test task",
            "type": "shell",
            "command": "./JacquesTestjj",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "presentation": {
                "reveal": "silent",
                "focus": true
            }
        }

Even if "focus=true", the focus will not be set to the terminal , it died before the terminal is registered.

Everything else seems to work fine

@elaihau
Copy link
Contributor Author

elaihau commented Jan 8, 2020

Tested the exit code: works fine as long as the task takes time before exiting.
It seems if the exit or crash occurs to fast, the focus is not put on the terminal. For example, created a task that does not exist, the task terminates before the terminal is being registered, so the focus does not get to the terminal.
Ex: Add the following in task.json (It does not exist)

{
            "label": "Jacques test task",
            "type": "shell",
            "command": "./JacquesTestjj",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "presentation": {
                "reveal": "silent",
                "focus": true
            }
        }

Even if "focus=true", the focus will not be set to the terminal , it died before the terminal is registered.

Everything else seems to work fine

Thank you for your time on testing !

You mentioned if the exit or crash occurs to fast, the focus is not put on the terminal
Could you please share what you have in ./JacquesTestjj? @lmcbout

@vince-fugnitto
Copy link
Member

For example, created a task that does not exist, the task terminates before the terminal is being registered, so the focus does not get to the terminal.

It might be the due to #2961.

@lmcbout
Copy link
Contributor

lmcbout commented Jan 8, 2020

You mentioned if the exit or crash occurs to fast, the focus is not put on the terminal
Could you please share what you have in ./JacquesTestjj?

The file JacquesTestjj does not exist, the file is JacquesTest which is:

#!/bin/bash
sleep 3
     echo "Jacques test"
     ls | bogus_command
     echo "Jacques: $? "
     exit 5

You need to make the file "executable" .
With sleep 3 --> you can see the result
Without sleep 3 -> too fast, no result. Yes it is the same as you reported as #2961
If you change the name of the file to "JacquesTestjj" in task.json, it performs similar as "without sleep 3"

Since this issue is tracked in another PR, I will approved this one since everything else is working as expected

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

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

Works fine , except when the process is too fast . Already reported in #2961

@elaihau elaihau merged commit c8b8854 into master Jan 9, 2020
@elaihau elaihau deleted the Liang/focus_reveal branch January 9, 2020 01:08
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 24, 2021
Support tasks presentation 'reveal' and 'focus' received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814, so
tasks provided via plugins can configure presentation options.

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 24, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 24, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 25, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 25, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Mar 29, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
alvsan09 added a commit to alvsan09/theia that referenced this pull request Apr 1, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
paul-marechal pushed a commit that referenced this pull request Apr 1, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request #6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
dna2github pushed a commit to dna2fork/theia that referenced this pull request Aug 25, 2021
Support tasks presentation options received from plugins

This expands the functionality introduced in pull request eclipse-theia#6814

The following presentation options are now available for use by
plugins:

presentationOptions.reveal
presentationOptions.focus
presentationOptions.echo
presentationOptions.showReuseMessage
presentationOptions.panel
presentationOptions.clear

Signed-off-by: Alvaro Sanchez-Leon <alvaro.sanchez-leon@ericsson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks issues related to the task system vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants