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

[Feature Request] setting for interactive tab; number of cell text output lines #3677

Closed
rholland opened this issue Jan 16, 2019 · 6 comments
Assignees

Comments

@rholland
Copy link

Environment data

  • VS Code version: 1.30.2
  • Extension version (available under the Extensions sidebar): 2019.1.0-alpha
  • OS and version: windows 7 and 10 and chrome
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 3.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda

Expected behaviour

First - thanks a lot for the default behavior of hiding input in the interactive window. It is very nice.

In previous versions of the extension the output frame for each cell appeared to be as long as necessary. This is preferred behavior in my view. In the insider build the max length is about 20 lines.

Actual behavior

In 2019-alpha the maximum output frame depth appears to be about 20 lines. Anything longer generates a scroll bar to view the rest. I strongly prefer the previous behavior of apparently unlimited frame depth. If others prefer the vertical scrolled behavior then could you please make a user controlled setting for the maximum lines per frame with a setting for no limit.

If for some reason you need to have a built-in fixed number at this point, please set it to a larger number - say 50 lines. 20 is too small and leads to fussy, non-intuitive behavior.

  1. The first problem is that cell output needs to be scrolled, which takes a lot of time and motion.

  2. The second problem is that scrolled windows are nested (the output frame within the interactive pane) so scrolling with a mouse gives awkward and unpredictable effects when looking at all the output.

  3. Because of the scroll in a scroll, the whole output cannot be easily reviewed from the keyboard - the cursor gets stuck in an output frame.

All of this leads to awkward behavior when reviewing cell output longer than a few lines and the output as a whole. If this behavior is just part of the alpha development and the behavior at release will not include individual scrolled cell outputs, rather the behavior will be the same as the past with unlimited cell output lengths, then disregard the above.

Thanks again for the great tool.

@rholland rholland changed the title request to keep previous output behavior for 2019.1.0 request to keep previous output behavior for upcoming 2019.1.0 Jan 16, 2019
@rholland rholland changed the title request to keep previous output behavior for upcoming 2019.1.0 request to keep previous output frame length behavior for upcoming 2019.1.0 Jan 16, 2019
@rholland rholland changed the title request to keep previous output frame length behavior for upcoming 2019.1.0 request to not change the individual output frame length behavior for upcoming 2019.1.0 Jan 16, 2019
@rholland rholland changed the title request to not change the individual output frame length behavior for upcoming 2019.1.0 request to not change the cell output frame length behavior for upcoming 2019.1.0 Jan 16, 2019
@rholland
Copy link
Author

rholland commented Jan 16, 2019

My issue is probably related to this issue:

Add support for running an entire file whether or not it has cells microsoft/vscode-python#3938

@rholland
Copy link
Author

rholland commented Jan 17, 2019

Looks like this is also now being discussed in microsoft/vscode-python#4009 for plots. Also need setting to apply to number of lines of text output.

@rholland rholland changed the title request to not change the cell output frame length behavior for upcoming 2019.1.0 [Feature Request] setting for cell output frame length Jan 17, 2019
@rholland rholland changed the title [Feature Request] setting for cell output frame length [Feature Request] setting for interactive tab; cell text output length Jan 17, 2019
@rholland rholland changed the title [Feature Request] setting for interactive tab; cell text output length [Feature Request] setting for interactive tab; number of cell text output lines Jan 17, 2019
@rholland
Copy link
Author

rholland commented Jan 17, 2019

The following images illustrate the current (insiders build) behavior as the interactive tab width is expanded. The text in the test output is about 40 lines.

When the interactive tab is narrow: horizontal scroll bar, no vertical scroll bar

vsc006

As it is expanded: no scroll bars

vsc007

As it is expanded to full width: vertical scroll bar reappears (upper and lower part of text shown)

vsc008

vsc009

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

Can you include the python code you executed to cause the problem?

I'm looking at this now and will likely add a setting. It won't be based on lines of text though, but rather pixels.

@rchiodo rchiodo self-assigned this Jan 17, 2019
@rholland
Copy link
Author

rholland commented Jan 17, 2019

Rich,

Here it is. You can comment out the imported image code or sub in a new one. Pixels are fine. Just needs to allow a big number.

The method arguments use string literals so markdown formatting below is affected.

Thanks.

======= code starts ========

`# %%
import sys
#sys.stdout.reconfigure(encoding='utf-8')
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import Image
from IPython.display import Math
from IPython.display import Latex
from IPython.display import HTML
from IPython.display import display

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "last"

from IPython.core.display import display,HTML
display(HTML('<style>.prompt{width: 0px; min-width: 0px; visibility: collapse}</style>'))

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread("E:\Dropbox\oncelib\onceproj\pic2.jpg", format='jpeg')
imgplot = plt.imshow(img)
plt.show()

gam = "\N{GREEK SMALL LETTER GAMMA}"
sig = "\N{GREEK SMALL LETTER SIGMA}"
Gam = "\N{GREEK CAPITAL LETTER GAMMA}"
Sig = "\N{GREEK CAPITAL LETTER SIGMA}"

def r__(ostr):
ostr1 = ostr.split('\n',1)
_vars = ostr1[1].splitlines()
for i in _vars: exec(i.strip())

def i__(ostr):
print(ostr)

def v__(ostr):
for i in ostr.split('\n'):
if len(i.strip()) > 0:
print(i)
if '=' in i:
exec(i.strip(), globals())

def e__(ostr):
for j in ostr.split('\n'):
if len(j.strip()) > 0:
if '=' in j:
k = j.split('=')[1]
nstr3 = str(j) + " = " + str(eval(k))
print(nstr3)
exec(j.strip(), globals())
else:
print(j)

def t__(ostr):
pass

def s__(ostr):
print(ostr)

#%%
r__(f'''| a caption plot | size | |
fig, ax1 = plt.subplots()
t = np.arange(0.01, 10.0, 0.01)
s1 = np.exp(t)
ax1.plot(t, s1, 'b-')
ax1.set_xlabel('time (s)')
# Make the y-axis label, ticks and tick labels match the line color.
ax1.set_ylabel('exp', color='b')
ax1.tick_params('y', colors='b')

    ax2 = ax1.twinx()
    s2 = np.sin(2 * np.pi * t)
    ax2.plot(t, s2, 'r.')
    ax2.set_ylabel('sin', color='r')
    ax2.tick_params('y', colors='r')

    fig.tight_layout()
    plt.show()
    ''')

i__(f'''| a caption image | size | |)
Image("20170921_152637bw.jpg")
''')

#%%
s__(f'''| s | bu | asdfa asdfsaf asdfad

    ''')

i__(f'''| t | ic | The need to distinguish between {gam} the various
meanings of "frame of reference" has led to a variety of terms. For
example, sometimes the type of coordinate system is attached as a
modifier, as in Cartesian frame of reference. Sometimes the state of
motion asfda asd s fdas sfdfasdfasdf is emphasized, as in rotating frame
of reference. Sometimes
''')

i__(f'''| l | y |

\alpha = \integral(x^2,x,a,b)

''')

v__(f'''values abcd | ref

    a11 = 12*4  #|2,2|
    a22 = 12.2
    a33 = 14
    ''')

e__(f'''equations abcd | ref

    aa2 = a11*4
    aa22 = a11*5

    ''')

#%% section 0
s__(f'''safdsa asdf dfa sdsd fasf

    some text lksd fasf asf asdlfsa fasd s asdlfma 
    dfsadfasd fas dfas dffasdlasd fsadfasd
    asdfsd  sadlfk sdf
    
    
     some text lksd fasf asf asdlfsa fasd s
    dfsadfasd fas dfas dffasdlasd fsadfasd
    asdfsd  sadlfk sdf
    
    
     some text lksd fasf asf asdlfsa fasd s
    dfsadfasd fas dfas dffasdlasd fsadfasd
    asdfsd  sadlfk sdf''')

i__(f'''This is a test {gam} = 2*{sig} of the system and this is a further test

of the system and another greek letter {Gam}

The need to distinguish between the various meanings of "frame of reference"
has led to a variety of terms. For example, sometimes the type of coordinate

the way it transforms to frames considered as related is emphasized as in
Galilean frame of reference. Sometimes frames are distinguished by the scale of
their observations, as in macroscopic and microscopic frames of reference.[1]

of the system and another greek letter {Gam}

The need to distinguish between the various meanings of "frame of reference"
has led to a variety of terms. For example, sometimes the type of coordinate

the way it transforms to frames considered as related is emphasized as in
Galilean frame of reference. Sometimes frames are distinguished by the scale of
their observations, as in macroscopic and microscopic frames of reference.[1]

''')

v__(f'''|some values | dasdfsa|

    gg = 5.4    # height of roof {gam}   |    |
    hh = 12.2   # height of balcony |   |            
    ''')

i__(f'''|text|

    this is a one liner 4 / {sig}
    ''')

e__('''|some equations | abcd | ref

    xx1 = gg + 4
    xx2 = hh + 10
    ''')

#%% section 0
s__(f'''safdsa asdf dfa sdsd fasf

     some text lksd fasf asf asdlfsa fasd s
    dfsadfasd fas dfas dffasdlasd fsadfasd
    asdfsd  sadlfk sdf''')

i__(f'''This is a test {gam} = 2*{sig} of the system and this is a further test

s considered as related is emphasized as in
Galilean frame of reference. Sometimes frames are distinguished by the scale of
their observations, as in macroscopic and microscopic frames of reference.[1]
''')

v__(f'''|some values | dasdfsa|

    gg = 5.4    # height of roof {gam}   |    |
    hh = 12.2   # height of balcony |   |            
    ''')

#%% section 0
s__(f'''safdsa asdf dfa sdsd fasf

     some text lksd fasf asf asdlfsa fasd s
    dfsadfasd fas dfas dffasdlasd fsadfasd
    asdfsd  sadlfk sdf''')

`
============ code ends ================

@rchiodo
Copy link
Contributor

rchiodo commented Feb 27, 2019

@rholland this should be fixed in our latest release. You can set a 'maxOutputSize' (-1 if you want no restrictions).

image

We use this value in the css for the output portion of a cell.

@rchiodo rchiodo closed this as completed Apr 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 22, 2019
@microsoft microsoft unlocked this conversation Nov 14, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants