KEMBAR78
Basic TOC button for jupyter notebooks by IanMatthewHuff · Pull Request #7651 · microsoft/vscode-jupyter · GitHub
Skip to content

Conversation

@IanMatthewHuff
Copy link
Member

For #7305

  • 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).

@IanMatthewHuff IanMatthewHuff requested a review from a team as a code owner September 23, 2021 22:43
@rchiodo
Copy link
Contributor

rchiodo commented Sep 23, 2021

I thought there was going to be a setting to turn it on/off?

@DonJayamanne
Copy link
Contributor

Isn't there a limit to the enumber of icons we can have in the global toolbar?
Hope this doesn't result in some of our other icons being hidden (going into overflow)

@IanMatthewHuff
Copy link
Member Author

IanMatthewHuff commented Sep 23, 2021

A couple of notes here.

  1. I made the button only enabled if the outline view is not visible and expanded. I could change this to just be visible if the notebook is open at all. Felt better to me this way, but I'm open to having it always available. Just feels funny as the button doesn't do much then, just moved the keyboard focus over.
  2. I called the short name (shown on the button) 'Outline' as it seemed shorter and more concise than "Table of Contents" long name in the palette is Jupyter: Open Notebook Outline
  3. Position is always right of Variables icon.
  4. Right now the button is available for any notebooks, but this doesn't mean that they have anything in the TOC, so it's not as useful for notebooks like this (see below):
    image
    I could engineer this to be disabled in these cases. The bit that seems iffy to me is that this outline content is based on vscode core code, we'd have to figure out a way to check if the outline view actually has content or not in a context key. I think that it requires markdown headers right now, but we'd be relying on that not changing if we were to base visibility on that. So I left that off for now.

@IanMatthewHuff
Copy link
Member Author

@rchiodo Totally forgot the setting, I'll update with that added.

@IanMatthewHuff
Copy link
Member Author

@claudiaregio and @greazer for UX visibility on this review.

@IanMatthewHuff
Copy link
Member Author

Isn't there a limit to the enumber of icons we can have in the global toolbar?
Hope this doesn't result in some of our other icons being hidden (going into overflow)

Yeah, I get ya. On my monitor it's not bad, as it's right next to the overflow button.
image
image

Could be an issue, but I am adding the setting to hide.

@greazer
Copy link
Member

greazer commented Sep 24, 2021

  1. I made the button only enabled if the outline view is not visible and expanded. I could change this to just be visible if the notebook is open at all. Felt better to me this way, but I'm open to having it always available. Just feels funny as the button doesn't do much then, just moved the keyboard focus over.

So the behavior you have right now is pretty much identical to that of the Variables Window right? Basically, if either window isn't visible and usable, then the button is enabled. If it's already being shown on the screen in a usable way, then it's disabled. Consistency here is the right way to go.

  1. I called the short name (shown on the button) 'Outline' as it seemed shorter and more concise than "Table of Contents" long name in the palette is Jupyter: Open Notebook Outline

Label seems ok to me. The main thing here is to make it more discoverable at all. Might want to consider creating a "wrapper" command called "Jupyter: Show Table of Contents (Outline View)" that is identical to "Explorer: Focus on Outline View"

  1. Position is always right of Variables icon.

Any particular reason? My quick thinking is that more people have likely asked for TOC than Variables Window. Ensuring that it's more likely to not be relegated to overflow seems like a good idea. BUT I'm not sure it matters much.

  1. Right now the button is available for any notebooks, but this doesn't mean that they have anything in the TOC, so it's not as useful for notebooks like this (see below):

The user can turn on code to be shown in the outline view. "Notebook: Outline: Show Code Cells", so it's not like this would always be the case for notebooks without markdown. Seems ok to me.

Copy link
Member

@greazer greazer left a comment

Choose a reason for hiding this comment

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

See my comments above. Otherwise looks fine to me.

@IanMatthewHuff
Copy link
Member Author

@greazer Inline.

So the behavior you have right now is pretty much identical to that of the Variables Window right? Basically, if either window isn't visible and usable, then the button is enabled. If it's already being shown on the screen in a usable way, then it's disabled. Consistency here is the right way to go.

Yup, if outline is off screen, or onscreen but collapsed the button is enabled. If it's on screen and expanded disable the button. Seemed smart as if it was on screen it was hard to even see that anything had happened when you clicked the button (only moved keyboard focus) made it seem a bit broken.

Label seems ok to me. The main thing here is to make it more discoverable at all. Might want to consider creating a "wrapper" command called "Jupyter: Show Table of Contents (Outline View)" that is identical to "Explorer: Focus on Outline View"

So the long title does show up in the command palette currently. Currently it's "Jupyter: Open Notebook Outline" but your text does have Table of Contents in it, so that might be a good change. I can change that.

Any particular reason? My quick thinking is that more people have likely asked for TOC than Variables Window. Ensuring that it's more likely to not be relegated to overflow seems like a good idea. BUT I'm not sure it matters much.

I was seeing it the other way around (variables over TOC) but I don't have data to back that up aside from our old requests for variable views being very upvoted. Mild preference would be to keep it how I have it as it add the "new" icon to the least dominate position so "Variable" will be in the same location for users muscle memory.

The user can turn on code to be shown in the outline view. "Notebook: Outline: Show Code Cells", so it's not like this would always be the case for notebooks without markdown. Seems ok to me.

Yeah, it seemed like it would open a bigger can of worms to try to check that.

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2021

Codecov Report

Merging #7651 (a6c0084) into main (5ea9ffc) will increase coverage by 0%.
The diff coverage is 50%.

@@          Coverage Diff          @@
##            main   #7651   +/-   ##
=====================================
  Coverage     68%     68%           
=====================================
  Files        363     363           
  Lines      22546   22556   +10     
  Branches    3430    3432    +2     
=====================================
+ Hits       15490   15506   +16     
+ Misses      5724    5715    -9     
- Partials    1332    1335    +3     
Impacted Files Coverage Δ
src/client/datascience/commands/commandRegistry.ts 35% <33%> (-1%) ⬇️
src/client/datascience/constants.ts 99% <100%> (+<1%) ⬆️
...ent/datascience/jupyter/pythonVariableRequester.ts 47% <0%> (-6%) ⬇️
src/client/datascience/kernel-launcher/types.ts 59% <0%> (-5%) ⬇️
.../kernel-launcher/localKnownPathKernelSpecFinder.ts 89% <0%> (-3%) ⬇️
src/client/datascience/jupyter/kernels/kernel.ts 74% <0%> (-1%) ⬇️
src/client/debugger/jupyter/debugControllers.ts 71% <0%> (-1%) ⬇️
src/client/debugger/jupyter/debuggingManager.ts 61% <0%> (-1%) ⬇️
...tascience/jupyter/kernels/kernelCommandListener.ts 56% <0%> (-1%) ⬇️
...ent/datascience/jupyter/kernels/kernelExecution.ts 69% <0%> (+<1%) ⬆️
... and 7 more

@IanMatthewHuff IanMatthewHuff merged commit aed3339 into main Sep 24, 2021
@IanMatthewHuff IanMatthewHuff deleted the dev/ianhu/tocButton branch September 24, 2021 22:36
@claudiaregio
Copy link
Contributor

@IanMatthewHuff @greazer @DonJayamanne Behavior here seems fine to me as well. I'm wondering now though if we think it makes sense now to have the toolbar default be icon only as opposed to with text? This is one of the few places we have to contribute to notebooks and for smaller monitors/laptops we are likely to end up in the overflow menu thus not solving the discoverability issue.

@IanMatthewHuff
Copy link
Member Author

@claudiaregio I've always been pro small icons, but if I recall from earlier discussions there are some pros to either side. Might be something to bring up at the next ux meeting maybe? Since it's an all up notebook issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants