vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Allow output channel to stay in scroll position

Open kaestlyn opened this issue 10 years ago • 11 comments

I would be nice if the output window if you are not on the bottom of the scroll position to keep your current position when new output is added.

Sometimes you're trying to read through the output and something new gets pushed there and then the scroll goes instantly to the bottom

kaestlyn avatar Feb 23 '16 16:02 kaestlyn

Because output channels is the only way for an extension to provide a window with some custom output, I think it's really essential to provide a way to tell an output channel at least not to scroll to the bottom.

Here is the real-world scenario we're having issues with in wallaby. A user is editing the code, we are creating the output where the relevant bit of information (last edited test) is the first displayed in the output. However, because the output is always scrolled to the bottom, the feature is not very usable.

vsc

Perhaps the export function createOutputChannel(name: string): OutputChannel; function could take an options object where one could disable the auto-scrolling?

//cc @jrieken

ArtemGovorov avatar Sep 07 '16 02:09 ArtemGovorov

makes sense

jrieken avatar Sep 07 '16 07:09 jrieken

Now the output will behave the same way the debug console does. If there is new output comming it will only auto scroll if the last line is revealed.

isidorn avatar Sep 07 '16 13:09 isidorn

@isidorn Awesome, thanks!

ArtemGovorov avatar Sep 07 '16 22:09 ArtemGovorov

Thanks!

kaestlyn avatar Sep 07 '16 23:09 kaestlyn

The solution (Version 1.6.0-insider) doesn't seem to work for our scenario (see the GIF above). My guess is that it happens because we're clearing the output, not appending to it.

ArtemGovorov avatar Sep 10 '16 02:09 ArtemGovorov

@isidorn Should I create a separate issue for output channels where the output is refreshed and not appended?

ArtemGovorov avatar Sep 15 '16 00:09 ArtemGovorov

@ArtemGovorov yes, please do.

isidorn avatar Sep 19 '16 08:09 isidorn

@isidorn Done: https://github.com/Microsoft/vscode/issues/12257

ArtemGovorov avatar Sep 19 '16 09:09 ArtemGovorov

I'm running 1.9.0-insider c5df118575aebc2e28a4addd4d4a29b899a514c5 and I am not seeing the output pane autoscroll (if starting from being cleared) nor of the scroll position is set to the end.

eamodio avatar Dec 16 '16 17:12 eamodio

Hi @eamodio I tried reproducing this and was unable, namely I wrote a vscode extension which writes to the output channel - for me it nicely autoscrolls to the end

If you can still reproduce this issue can you please create a new issue with a small sample for which this can been seen. And just ping me on the issue - thanks!

'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

    // Use the console to output diagnostic information (console.log) and errors (console.error)
    // This line of code will only be executed once when your extension is activated
    console.log('Congratulations, your extension "ts-extension" is now active!');

    // The command has been defined in the package.json file
    // Now provide the implementation of the command with  registerCommand
    // The commandId parameter must match the command field in package.json
    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
        // The code you place here will be executed every time your command is executed
        const output = vscode.window.createOutputChannel('isidor');
        output.show();
        for (var i = 0; i < 100; i++) {
            output.appendLine('hello');
         }
        // Display a message box to the user
        vscode.window.showInformationMessage('Hello World!');
    });

    
    context.subscriptions.push(disposable);

}

isidorn avatar Dec 20 '16 09:12 isidorn