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

Debug console stops autoscrolling when a line wraps around #77837

Closed
banga opened this issue Jul 23, 2019 · 19 comments · Fixed by #82945
Closed

Debug console stops autoscrolling when a line wraps around #77837

banga opened this issue Jul 23, 2019 · 19 comments · Fixed by #82945
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-found Issue verification failed verified Verification succeeded
Milestone

Comments

@banga
Copy link

banga commented Jul 23, 2019

Issue Type: Bug

  • 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 (2213894, 2019-07-08T22:56:38.504Z)
OS version: Darwin x64 18.6.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz (8 x 2900)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 6, 5, 5
Memory (System) 16.00GB (0.12GB free)
Process Argv
Screen Reader no
VM 0%
@isidorn isidorn added this to the August 2019 milestone Jul 30, 2019
@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues under-discussion Issue is under discussion for relevance, priority, approach labels Jul 30, 2019
@sguillia
Copy link

I can reproduce this, but only if the debug console panel is moved right, not bottom.

@JoshVarty
Copy link

I am also running into this.

Possibly related: #70331

  • VSCode Version: 1.37.1
  • OS Version: Ubuntu 18.04.3 LTS

Steps to Reproduce:

  1. Create a new Python project (requires numpy)
  2. Add the code:
import numpy as np
x = 5
  1. Place a breakpoint on x=5
  2. Run the code, allow the breakpoint to be hit.
  3. In the debug console type: np.ones((720,1))
  4. In the debug console type: 4+4
  5. Observe that the scroll returns to the top of the debug console

Does this issue occur when all extensions are disabled?: Yes

poor_scrolling

@isidorn
Copy link
Contributor

isidorn commented Aug 30, 2019

@JoshVarty nice steps. Thanks. I plan to look next week into this.

@isidorn
Copy link
Contributor

isidorn commented Sep 10, 2019

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 pip install numpy I get an exception when debugging the program No module named 'numpy')

I believe the issue is here

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.

@isidorn isidorn modified the milestones: September 2019, On Deck Sep 10, 2019
@JoshVarty
Copy link

JoshVarty commented Sep 10, 2019 via email

@isidorn
Copy link
Contributor

isidorn commented Sep 11, 2019

Nope, this works for me

heyThere

@sguillia
Copy link

sguillia commented Sep 11, 2019

@isidorn

The line doesn't wrap around because the output is trimmed. You might want to try this instead:

'-'.join([str(i) for i in range(2000)])

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 #79213 (install Python extension, start debug session, move panel to right)

@bersbersbers
Copy link

bersbersbers commented Sep 12, 2019

In trying to come up with a numpy-free set of repro steps (I failed), I noticed something unexpected. In the Python stand-alone console, numpy.ones((5,1)) outputs

array([[1.],
       [1.],
       [1.],
       [1.],
       [1.]])

while in the Debug Console, it outputs

array([[1.],\n       [1.],\n       [1.],\n       [1.],\n       [1.]])

The same is not true for some other non-numpy multiline-output, such as the one from print("a\nb"), which is shown in two lines in both cases. Also, commands such as print(str(numpy.ones((720,1)))) (note the extra str) do not cause this issue.

Based on this, consider the following hypotheses (speculative, but nevertheless):

  1. This is a numpy-specific problem, so @isidorn might have a hard time reproducing it without setting up numpy in his Python environment.
  2. VS Code uses a correct internal rendering of the output to estimate its height, but the actual output has a lower height due to \n 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 \n characters.

@isidorn
Copy link
Contributor

isidorn commented Sep 12, 2019

Point 2. makes sense. However this is not only specific to numpy, but to a particular type of output.

@JoshVarty
Copy link

I think it has something to do with Python's __repr__ (which might mean this isn't a VSCode bug, but a Python tools bug?)

I believe __repr__ creates a representation of a Python object for use in things like debuggers.

Anyways, I've got a numpy-free repro for you:

  1. Create a new Python project
  2. Add the code:
class Test:
    def __repr__(self):
        return "\n\t" * 10000
x = Test()

y = "this line is for your breakpoint"
  1. Place a breakpoint on y = "this line is for your breakpoint"
  2. Run the code, allow the breakpoint to be hit.
  3. In the debug console type: x
  4. In the debug console type: 4+4
  5. Observe that the scroll returns to the top of the debug console

What's interesting is that if you create x="\n\t" * 10000 and then observe x in the debug console, you'll notice that it prints the value of x properly and has no problems with any subsequent commands in the debug console.

This only seems to reproduce for me within the context of __repr__.

@sguillia
Copy link

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:

  1. Run command ext install ms-python.python
  2. Open this extension sample folder in vscode
  3. Start debugging session (F5)
  4. Open debug console on host
  5. Move it to the right
  6. Open 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.

@isidorn
Copy link
Contributor

isidorn commented Sep 26, 2019

@JoshVarty thanks for awesome repro steps. I can repro now, investigating...

@isidorn isidorn modified the milestones: On Deck, September 2019 Sep 26, 2019
@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug and removed under-discussion Issue is under discussion for relevance, priority, approach labels Sep 26, 2019
@isidorn isidorn closed this as completed in a8a448d Oct 2, 2019
@sguillia
Copy link

sguillia commented Oct 2, 2019

Thanks! 🎉

@alexr00 alexr00 added the verification-found Issue verification failed label Oct 4, 2019
@alexr00
Copy link
Member

alexr00 commented Oct 4, 2019

I verified using the nice steps here: #77837 (comment)
I'm still seeing scroll return to the top of the console.

@alexr00 alexr00 reopened this Oct 4, 2019
@isidorn
Copy link
Contributor

isidorn commented Oct 4, 2019

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 #81951 (comment)

@isidorn isidorn closed this as completed Oct 4, 2019
@RMacfarlane RMacfarlane added the *duplicate Issue identified as a duplicate of another issue(s) label Oct 4, 2019
isidorn added a commit that referenced this issue Oct 8, 2019
This reverts commit a8a448d.
@isidorn
Copy link
Contributor

isidorn commented Oct 8, 2019

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 🙏

@isidorn isidorn reopened this Oct 8, 2019
@isidorn isidorn modified the milestones: September 2019, October 2019 Oct 8, 2019
@isidorn isidorn removed the *duplicate Issue identified as a duplicate of another issue(s) label Oct 8, 2019
isidorn added a commit that referenced this issue Oct 8, 2019
This reverts commit a8a448d.
isidorn added a commit that referenced this issue Oct 8, 2019
jeanp413 added a commit to jeanp413/vscode that referenced this issue Oct 20, 2019
jeanp413 added a commit to jeanp413/vscode that referenced this issue Oct 21, 2019
@isidorn
Copy link
Contributor

isidorn commented Oct 21, 2019

@jeanp413 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!

jrieken pushed a commit that referenced this issue Oct 21, 2019
@rickstaa
Copy link

rickstaa commented Oct 23, 2019

@jeanp413 The fix is working. I now have the desired scroll behaviour back! @jeanp413 and @isidorn Thanks a lot!

@isidorn
Copy link
Contributor

isidorn commented Oct 23, 2019

Thanks, adding verified label.

@isidorn isidorn added the verified Verification succeeded label Oct 23, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-found Issue verification failed verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants