Skip to content

Add a setting to more clearly enable scrolling on cell outputs #11222

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

Merged
merged 6 commits into from
Apr 21, 2020

Conversation

DavidKutu
Copy link

For #9801

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@@ -536,9 +537,10 @@ export class CellOutput extends React.Component<ICellOutputProps> {
const style: React.CSSProperties = {};

// Create a scrollbar style if necessary
if (transformedList.some((transformed) => transformed.output.renderWithScrollbars) && this.props.maxTextSize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxTextSize [](start = 105, length = 11)

We already has this value. Why is this not sufficient? It does the same thing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmew and I thought renaming it to "Enable scrolling for cell outputs" and having it be a checkbox would be more clear to users (that's how the setting is named in jupyter lab). And I didn't want to remove the functionality to be able to resize the output so I left it in. I'm open to suggestions.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if maxOutputSize is set to -1, we will suddenly force everybody to have a max output size of 400. When they really wanted no scroll bars.


In reply to: 409903189 [](ancestors = 409903189)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That never happens, if maxOutputSize is set to -1, weather this new setting is true or false, no scrollbar appears.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I'm following the logic for that.

If maxOutputSize is set to -1, this.props.maxTextSize is undefined.
If the setting for enable scrolling is true, it will go to line 541, where suddenly the text size will be 400


In reply to: 409912783 [](ancestors = 409912783)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and @IanMatthewHuff I dont believe they have a setting to control the max height for truncation

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the new setting, but we should fix the problem of it auto truncating when maxTextSize is -1. That would be a bug


In reply to: 409925767 [](ancestors = 409925767)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxTextSize of -1 should be equivalent to enableScrolling being false.


In reply to: 409930365 [](ancestors = 409930365,409925767)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause otherwise you're going to break existing users.


In reply to: 409930466 [](ancestors = 409930466,409930365,409925767)

@codecov-io
Copy link

codecov-io commented Apr 17, 2020

Codecov Report

Merging #11222 into master will decrease coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11222      +/-   ##
==========================================
- Coverage   61.39%   61.10%   -0.30%     
==========================================
  Files         604      602       -2     
  Lines       33501    33146     -355     
  Branches     4739     4684      -55     
==========================================
- Hits        20568    20253     -315     
+ Misses      11877    11870       -7     
+ Partials     1056     1023      -33     
Impacted Files Coverage Δ
src/client/common/types.ts 100.00% <ø> (ø)
...c/datascience-ui/react-common/settingsReactSide.ts 22.22% <ø> (ø)
.../datascience/jupyter/interpreter/jupyterCommand.ts 9.48% <0.00%> (-45.69%) ⬇️
src/client/datascience/jupyter/jupyterUtils.ts 57.14% <0.00%> (-17.28%) ⬇️
src/client/common/errors/errorUtils.ts 50.00% <0.00%> (-16.67%) ⬇️
src/datascience-ui/react-common/arePathsSame.ts 75.00% <0.00%> (-12.50%) ⬇️
src/client/common/utils/platform.ts 64.70% <0.00%> (-11.77%) ⬇️
...t/datascience/jupyter/kernels/jupyterKernelSpec.ts 92.00% <0.00%> (-8.00%) ⬇️
src/client/common/cancellation.ts 69.38% <0.00%> (-4.09%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 342eacc...c615f44. Read the comment docs.

@@ -536,9 +537,10 @@ export class CellOutput extends React.Component<ICellOutputProps> {
const style: React.CSSProperties = {};

// Create a scrollbar style if necessary
if (transformedList.some((transformed) => transformed.output.renderWithScrollbars) && this.props.maxTextSize) {
if (transformedList.some((transformed) => transformed.output.renderWithScrollbars) && this.props.enableScroll) {
Copy link

@DonJayamanne DonJayamanne Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should just use react context. This way we don't have to pass down props through all these layers.. I know i've brought this up in the past... We keep modifying 3-4 files for such things.

Comment on lines 328 to 329
const maxOutputSize = this.props.settings.maxOutputSize;
const maxTextSize = maxOutputSize && maxOutputSize < 10000 && maxOutputSize > 0 ? maxOutputSize : undefined;
Copy link

@DonJayamanne DonJayamanne Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This number 10000 is hardcoded in two places, time for a constant.
Also, I'd move the following code into its own function (this change is optional).

Suggested change
const maxOutputSize = this.props.settings.maxOutputSize;
const maxTextSize = maxOutputSize && maxOutputSize < 10000 && maxOutputSize > 0 ? maxOutputSize : undefined;
const maxOutputSize = this.props.settings.maxOutputSize;
const maxTextSize = maxOutputSize && maxOutputSize < 10000 && maxOutputSize > 0 ? maxOutputSize : undefined;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@DonJayamanne DonJayamanne Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not done, number is hardcoded and identical code in two places.
Can just move into a function and re-use from two places.
Either use a constant for 1000 or add comments. Right now looking at the code I don't know what 10000, is it lines or character count, or pixels? (hence the suggestion to use a costant)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By two places do you mean nativeEditor.tsx and interactivePanel.tsx? To reuse it in those 2 places I'd have to create a helpers file just for that one line function, or put it in another file that doesn't make sense. Is that what you want?
For now I used a constant

@DavidKutu DavidKutu requested a review from DonJayamanne April 17, 2020 20:46
Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@DavidKutu DavidKutu merged commit ba779fa into master Apr 21, 2020
@DavidKutu DavidKutu deleted the davidkutu/truncatedPlotOutputs branch April 21, 2020 17:21
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants