Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely disable output scroll lock in Visual Studio Code?

As far as I could gather, even though VS Code's Output Panel has a Toggle Output Scroll Lock icon in its title area

Toggle Output Scroll Lock

it still uses a feature called smart lock which means scrolling is enabled only if the output area is already scrolled all the way down to the bottom before the new output is generated (more on this here).

I use Code Runner and ensuring output area is manually scrolled down each time I run my code to see anything is driving me nuts.

like image 760
z33k Avatar asked Aug 23 '18 15:08

z33k


3 Answers

It looks like the fix for this was released in March 2020 rather silently, as the hidden setting output.smartScroll.enabled.

You'll need to make the following change in settings.json:

  "output.smartScroll.enabled": false

Found this change mentioned here: https://github.com/microsoft/vscode/issues/69480#issuecomment-593401640

like image 117
interestinglythere Avatar answered Oct 09 '22 22:10

interestinglythere


No solution right now (May 2019)

I don't know if this behavior is intended or if it's a bug, but I think currently there is no real solution to entirely solve this problem.

Maybe the provided workarounds help you to better stay in control of how the output scrolling works.

Workarounds

Bring focus back to current output

  1. Disable scroll lock: open lock button (lock should now be open)
  2. Click the "Clear Output"-button: clear output button
    (or open the context menu of the output console (right click) and choose "Clear Output")
  3. Remove focus: Make sure the output console is not focused anymore
  4. Re-run the program
    (with Code Runner: ctrl + alt + N)

Avoid the problem

If you need to check some output which isn't in the current view, hover over the output window and make sure to just scroll using your mouse wheel without clicking inside the output window.


Tested with VSCode version 1.33.1 and CodeRunner version v0.9.9.

like image 36
winklerrr Avatar answered Oct 09 '22 22:10

winklerrr


Also, just found this setting - while not the exact fix, it could be a relief to many people. Put the following setting in your settings.json file:

    "code-runner.clearPreviousOutput": true,

This will clear the old output every time you run the code and display only the current output.

like image 1
techexpert Avatar answered Oct 10 '22 00:10

techexpert