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

Task>Presentation should allow to clear the terminal output. #30058

Closed
dbaeumer opened this issue Jul 3, 2017 · 24 comments · Fixed by #61329
Closed

Task>Presentation should allow to clear the terminal output. #30058

dbaeumer opened this issue Jul 3, 2017 · 24 comments · Fixed by #61329
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities tasks Task system issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Jul 3, 2017

No description provided.

@vscodebot vscodebot bot added the terminal Integrated terminal issues label Jul 3, 2017
@dbaeumer dbaeumer assigned dbaeumer and unassigned Tyriar Jul 3, 2017
@dbaeumer dbaeumer added this to the On Deck milestone Jul 3, 2017
@dbaeumer dbaeumer added tasks Task system issues feature-request Request for new features or functionality and removed terminal Integrated terminal issues labels Jul 3, 2017
@SE2Dev
Copy link

SE2Dev commented Sep 5, 2017

Does this issue refer to automatically clearing the terminal output when a task begins? I've been searching for a way to do that.

@dbaeumer
Copy link
Member Author

dbaeumer commented Sep 6, 2017

Yes, this is the feature request.

@sanny-io
Copy link

I really wish this was a thing.

@SSmokWawelski
Copy link

+1

2 similar comments
@leNEKO
Copy link

leNEKO commented Jun 1, 2018

+1

@philipedwards
Copy link

+1

@mateuszuram
Copy link

Hi,
One way to do that is to add clear command before actual task command like below.
"command": "clear;ninja",
I'm using tcsh shell and ninja to build.
Regards,
Mat

@Geobert
Copy link

Geobert commented Jul 1, 2018

Does not work for me, VSCode on Win10.

@mateuszuram
Copy link

Windows doesn't have clear command, but you can try cls:
"command": "cls;ninja",

@Geobert
Copy link

Geobert commented Jul 2, 2018

No luck neither :(

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder cobalt.rs: cls;cargo check <

@rookiezn
Copy link

rookiezn commented Jul 6, 2018

It works for me by just adding a "clear" command before my real task command. Like this

      "command":[
        "clear;",
        "clang++ -g -O0 a.cpp"
      ],

Do NOT miss the semicolon after "clear"

@Geobert
Copy link

Geobert commented Jul 6, 2018

Still no luck on Windows 10. using 1.25.

Funny enough, without the the semicolon, I lose all the command output:

> Executing task: cls cargo check <

Terminal will be reused by tasks, press any key to close it.

@WSLUser
Copy link

WSLUser commented Jul 6, 2018

@Geobert Try using WSL. The workaround will work there (on Linux side ofc) plus plenty of benefits to using it.

@Geobert
Copy link

Geobert commented Jul 6, 2018

I can't, Win 7 :(

@anssilap
Copy link

+1

I've tried so many workarounds for this it is starting to wear me out. Even a build task that depends on another task that clears the terminal doesn't work. I suppose because clearing uses "type": "process" and my gcc build task uses "type": "shell". I am either stuck periodically deleting all the new terminal instances created for each build or spending time figuring out where output of latest build ends and old one begins.

@mmatrosov
Copy link

Any progress on the issue? Any workaround working on Windows 10?

@dbaeumer
Copy link
Member Author

As always a PR will help to speed things up.

@dbaeumer dbaeumer added the help wanted Issues identified as good community contribution opportunities label Aug 23, 2018
@mikbal54
Copy link

mikbal54 commented Sep 1, 2018

cls command in task runner does not work. I dont like scrolling to the bottom to check the error messages.

@konstk1
Copy link

konstk1 commented Oct 16, 2018

+1 Also looking for this functionality.

@dbaeumer
Copy link
Member Author

@alexr00 This would actually be a good first feature-request. Only limited changes.

@junglie85
Copy link

As a workaround, try creating a composite task, where the actual task you want to execute depends on the task to clear the terminal. For example:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "clear terminal",
      "type": "shell",
      "command":"clear",
      "presentation": {
        "echo": false,
        "reveal": "always",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false
      }
    },
    {
      "label": "mix test",
      "dependsOn":["clear terminal"],
      "type": "shell",
      "command":"mix",
      "args": ["test", "--color", "--trace"],
      "options": {
        "cwd": "${workspaceRoot}",
        "requireFiles": [
          "test/**/test_helper.exs",
          "test/**/*_test.exs"
        ],
      },
      "problemMatcher": "$mixTestFailure",
      "presentation": {
        "echo": false,
        "reveal": "always",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false
      }
    }
  ]
}

@Geobert
Copy link

Geobert commented Oct 17, 2018

As a workaround, try creating a composite task, where the actual task you want to execute depends on the task to clear the terminal.

At first I thought it worked, but it only "hides above" the previous launch (at least on Windows). If you scroll up, you'll see the previous launches output

@junglie85
Copy link

junglie85 commented Oct 17, 2018

So it does. I hadn't noticed that. What's even more interesting is that if (in my example) I bin the Task - mix test terminal and run the task, then it only sometimes exhibits that behaviour, whilst at other times it "hides above".

For my example, it seems to be if I run a passing test suite then the behaviour is as I would expect, whether that is from the command pallet or a custom key binding. If I run a failing test suite at any time, it reverts to the "hide above" behaviour until I bin the terminal. I wonder why that would be?

Very frustrating. Is there perhaps a way to run a shell task, e.g. echo "" which takes the focus and then simulate a keypress to terminate the shell? This could then be run as a predecessor task. Or is there some way to execute the workbench.action.terminal.kill command from a task?

Another workaround, broadly similar to the above is to change the task to give the shell the focus. Rebind cmd+k or equivalent from workbench.action.terminal.clear to workbench.action.terminal.kill and then make this a step in the workflow (not great if the task runs for more than a second or so). It's another keypress but it's a step closer.

{
  "key": "cmd+k",
  "command": "workbench.action.terminal.kill"
}

@Geobert
Copy link

Geobert commented Oct 17, 2018

At home with my gaming mouse (with buttons on thumb side), I've done this exactly: focus term, press space, run task. But at work I don't have such mouse ^^'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities tasks Task system issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.