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

Jump to Bottom of Integrated Terminal When Running PowerShell #1257

Closed
vhusker opened this issue Apr 4, 2018 · 10 comments · Fixed by #1407
Closed

Jump to Bottom of Integrated Terminal When Running PowerShell #1257

vhusker opened this issue Apr 4, 2018 · 10 comments · Fixed by #1407
Labels
Area-Extension Terminal Issue-Enhancement A feature request (enhancement).

Comments

@vhusker
Copy link

vhusker commented Apr 4, 2018

System Details

  • Operating system name and version:
  • VS Code version:
  • PowerShell extension version:
  • Output from $PSVersionTable:
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
1.21.1
79b44aa704ce542d8ca4a3cc44cfca566e7720f1
x64
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
bradygaster.azuretoolsforvscode@2.0.2
ed-elliott.azure-arm-template-helper@0.0.17
geddski.macros@1.2.1
KnisterPeter.vscode-github@0.27.1
ms-azuretools.vscode-azureappservice@0.6.1
ms-azuretools.vscode-azurefunctions@0.7.0
ms-azuretools.vscode-azurestorage@0.2.0
ms-mssql.mssql@1.3.0
ms-python.python@2018.3.1
ms-vscode.azure-account@0.3.3
ms-vscode.PowerShell@1.6.0
msazurermtools.azurerm-vscode-tools@0.4.0
PeterJausovec.vscode-docker@0.0.26
robertohuertasm.vscode-icons@7.22.0
Shan.code-settings-sync@2.9.0
$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Run a command in PowerShell that sends a bunch of output to the terminal window. Scroll up through the terminal window so that you can't see the bottom. Run a command in the editor window, and the terminal window doesn't move. Would love to have a setting (if not the default) that jumps to the bottom of the terminal window when it's not visible. I outlined how to do this (and referenced a StackOverflow question) about how to do this in Code with the Macros extension. https://jacobbenson.io/index.php/2018/03/27/jump-to-terminal-in-visual-studio-code-when-running-powershell/

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

@TylerLeonhardt
Copy link
Member

Sounds like a reasonable request. Thanks for opening this! Question for you, does this work in the default Powershell/cmd/bash terminal in vscode or does it not scroll down only in the PowerShell Integrated Console?

@vhusker
Copy link
Author

vhusker commented Apr 9, 2018

How can I test this? Whenever I run anything that's PowerShell it jumps to the PowerShell Integrated Console.

@TylerLeonhardt
Copy link
Member

Ah. Reading the issue again I see what you mean - ignore my question :)

I missed this part:

Run a command in the editor window

@prof7bit
Copy link

prof7bit commented Jul 3, 2018

This is not limited to PowerShell, the topic of this issue should be changed.

And the issue should be moved to VSCode itself and not the powershell plugin.

I am currently using VSCode with the Rust plugin on Linux and when I start a build it outputs the build log on the integrated terminal and once I have scrolled up to read the errors it will no longer autoscroll when I start a new build. This is extremely annoying.

@Sharken03
Copy link

Workaround for PowerShell:
Install the macros extension, then define macros and keybindings as outlined here.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jul 7, 2018

@Tyriar pinging you because of @prof7bit's added comment that this also happens in the Rust extension.

Do you folks have a way for us to add this? Or should we open an issue on vscode?

@Tyriar
Copy link
Contributor

Tyriar commented Jul 7, 2018

If it makes sense for an extension to scroll to the bottom then it can call workbench.action.terminal.scrollToBottom when it's running the new command. In the general case VS Code will only do this automatically on keyboard input and it doesn't make sense to add a setting to do otherwise, this would be super annoying if you wanted to look at output while running a command.

@TylerLeonhardt
Copy link
Member

We probably want to invoke this when sending certain requests then. I think the big one is F8 (Run Selection). Which would probably be as simple as adding:

let success = await commands.executeCommand('workbench.action.terminal.scrollToBottom');

to this block of code.

@rkeithhill
Copy link
Contributor

This works well:

vscode.commands.registerCommand("PowerShell.RunSelection", async () => {
...
    // Show the integrated console if it isn't already visible and scroll console to see output
    await vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true);
    await vscode.commands.executeCommand("workbench.action.terminal.scrollToBottom");

Want me to PR that? Also, should we put this behavior behind a setting? I would default it to scroll to bottom. Even though that is a change in behavior, it is the behavior most folks expect IMO.

@Tyriar
Copy link
Contributor

Tyriar commented Jul 9, 2018

Looks good 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extension Terminal Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants