Change:
Issue Type: <bBug</b- Make sure the debug console is narrow enough that at least one line will wrap around Scroll all the way to the bottom of the debug console so it will autoscroll as more output is generated Run any task that produces output with long lines Notice that when a line that wraps around is printed, autoscrolling stops working and you have to manually scroll to the end to resume it. VS Code version: Code 1.36.1 (, 2019-07-08T22:56:38.504Z) OS version: Darwin x64 18.6.0 <details<summarySystem Info</summary </details<!-- generated by issue reporter --
I can reproduce this, but only if the debug console panel is moved right, not bottom.
I am also running into this. Possibly related: <!-- Use Help Report Issue to prefill these. --- VSCode Version: 1.37.1 OS Version: Ubuntu 18.04.3 LTS Steps to Reproduce: a new Python project (requires ) the code: a breakpoint on the code, allow the breakpoint to be hit. the debug console type: the debug console type: that the scroll returns to the top of the debug console <!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes !
nice steps. Thanks. I plan to look next week into this.
I can not reproduce this with node, even though I have multiple lines that wrap. Unfortunetly I do not have pyhton setup on my machine to follow the exact python steps (after doing I get an exception when debugging the program ) I believe the issue is I am open for a PR which fixes this. The solution would be to better aproximate the height based on the value length. Due to this bad approximation the autoscrolling breaks.
I'm away from my desk this week so I can't double check myself, but instead of using numpy you could try '[i for i in range()]' in the debugger. That should return a list of 20,000 numbers and I would assume be long enough to trigger the bug.
Nope, this works for me !
The line doesn't wrap around because the output is trimmed. You might want to try this instead: Also I can only reproduce with the debug panel on the right (Right click Move panel right). I can't reproduce the problem with that python line above though. It do with the steps here (install Python extension, start debug session, move panel to right)
In trying to come up with a -free set of repro steps (I failed), I noticed something unexpected. In the Python stand-alone console, outputs while in the Debug Console, it outputs The same is not true for some other non- multiline-output, such as the one from , which is shown in two lines in both cases. Also, commands such as (note the extra ) do not cause this issue. Based on this, consider the following hypotheses (speculative, but nevertheless): is a -specific problem, so might have a hard time reproducing it without setting up in his Python environment. Code uses a correct internal rendering of the output to estimate its height, but the actual output has a lower height due to being printed instead of converted into line breaks. This causes a height mismatch somewhere, leading to incorrect vertical scroll positions. This is somewhat supported by the "Copy All" command in the Debug Console copying line breaks, not characters.
Point 2. makes sense. However this is not only specific to numpy, but to a particular type of output.
I think it has something to do with Python's (which might mean this isn't a VSCode bug, but a Python tools bug?) I believe creates a representation of a Python object for use in things like debuggers. Anyways, I've got a numpy-free repro for you: a new Python project the code: a breakpoint on the code, allow the breakpoint to be hit. the debug console type: the debug console type: that the scroll returns to the top of the debug console What's interesting is that if you create and then observe in the debug console, you'll notice that it prints the value of properly and has no problems with any subsequent commands in the debug console. This only seems to reproduce for me within the context of .
Can you all reproduce this with the debug console panel to the bottom? I can only when it's to the right. Here are my steps to reproduce: command folder in vscode debugging session (F5) debug console on host it to the right a python file in the guest And observe the scrolling problem. This forces me to have the debug console at the bottom while developing an extension.
thanks for awesome repro steps. I can repro now, investigating...
Thanks! :tada:
I verified using the nice steps here: I'm still seeing scroll return to the top of the console.
Let's keep this closed since there is already a duplicate which I will look into next milestone. Though it should behave a bit better now Duplicate
Actually my fix just made it worse. Sorry about that. Reverting my fix and reopening this issue. This milestone I will fix this proper, promise
contributed a cool fix for this, thanks a lot! Can people please try this out in vscode insiders from Tuesday and let us know if it is better for you. Thanks a lot!
The fix is working. I now have the desired scroll behaviour back! and Thanks a lot!
Thanks, adding verified label.

Discussion:
class ReplDelegate implements IListVirtualDelegate<IReplElement> { <ins> private heightCache = new WeakMap<IReplElement, number>(); </ins> constructor(private configurationService: IConfigurationService) { } getHeight(element: IReplElement): number { const countNumberOfLines = (str: string) => Math.max(1, (str && str.match(/rn|n/g) || []).length); <ins> const hasValue = (e: any): e is { value: string } => typeof e.value === 'string'; </ins> // Give approximate heights. Repl has dynamic height so the tree will measure the actual height on its own. const config = this.configurationService.getValue<IDebugConfiguration>('debug'); <del> const fontSize = config.console.fontSize; </del> <ins> const { fontSize, wordWrap } = config.console; </ins> const rowHeight = Math.ceil(1.4 * fontSize); <del> const wordWrap = config.console.wordWrap; </del> if (!wordWrap) { return rowHeight; } <del> // In order to keep scroll position we need to give a good approximation to the tree // For every 150 characters increase the number of lines needed if (element instanceof ReplEvaluationResult) { let value = element.value; if (element.hasChildren) { return rowHeight; } let valueRows = value ? (countNumberOfLines(value) + Math.floor(value.length / 150)) : 0; return rowHeight * valueRows; </del> <ins> const cachedHeight = this.heightCache.get(element); if (typeof cachedHeight === 'number') { return cachedHeight; </ins> } <del> if (element instanceof SimpleReplElement || element instanceof ReplEvaluationInput) { </del> <ins> // Calculate a rough overestimation for the height // For every 30 characters increase the number of lines needed if (hasValue(element)) { </ins> let value = element.value; <del> let valueRows = countNumberOfLines(value) + Math.floor(value.length / 150); </del> <ins> let valueRows = countNumberOfLines(value) + Math.floor(value.length / 30); </ins> return valueRows * rowHeight; }

return ReplRawObjectsRenderer.ID; } <del> hasDynamicHeight?(element: IReplElement): boolean { </del> <ins> hasDynamicHeight(element: IReplElement): boolean { </ins> // Empty elements should not have dynamic height since they will be invisible return element.toString().length > 0; } <ins> setDynamicHeight(element: IReplElement, height: number): void { this.heightCache.set(element, height); } </ins> } function isDebugSession(obj: any): obj is IDebugSession {