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

A "tight layout" mode that reduces vertical spacing #175295

Open
kolibril13 opened this issue Feb 23, 2023 · 8 comments
Open

A "tight layout" mode that reduces vertical spacing #175295

kolibril13 opened this issue Feb 23, 2023 · 8 comments
Assignees
Labels
feature-request Request for new features or functionality notebook-layout
Milestone

Comments

@kolibril13
Copy link

A design with generous vertical spacing looks nice on big screens.

However, on a small Laptop screen, it's in my opinion better to have a tighter layout to fit more lines of code on the screen.
Therefore, it would be nice to have a "tight layout" mode, that reduces vertical spacing in a notebook.
I've made 4 screenshots from the same notebook to show how vertical spacing is varying from platform to platform (and VSCode wins the contest of largest white space areas):

  1. from JupyterLab
  2. from a Gist
  3. from VS Code
  4. from VS Code diff

All screenshots are made with default zoom setting and used this notebook https://gist.github.com/kolibril13/cdecff2da4f12dcbc5ffae449a5e9572
My machine is a MacBoc Air M1, Retina display, 13.3-inch (diagonal).

It would be amazing if vertical spacing was customizable in VS Code Jupyter!

  1. JupyterLab

image

  1. Gist on GitHub

image

  1. VSCode (note how the last cell output is not on the screen anymore)

image

  1. VSCode diff

image

@kolibril13 kolibril13 added the feature-request Request for new features or functionality label Feb 23, 2023
@amunger amunger transferred this issue from microsoft/vscode-jupyter Feb 23, 2023
@amunger
Copy link
Contributor

amunger commented Feb 24, 2023

related, but for IW: #156803

@rebornix
Copy link
Member

@kolibril13 thanks for your feedback. This has been brought up multiple times and we can see the value of having a more compact view for notebook editor.

The main reason VS Code's default notebook view has more spacing is it renders more components than the Jupyter Notebook, including

  • A toolbar to insert between cells
  • A breadcrumb to show the TOC of the notebook file and cell
  • Cell toolbar which allows you to run operations against the target cell
  • Cell status bar for execution state and cell language

If we disable these components (the functionalities are still available through commands, or through other components) with following settings

    "notebook.insertToolbarLocation": "notebookToolbar",
    "breadcrumbs.enabled": false,
    "notebook.showCellStatusBar": "hidden",
    "notebook.cellToolbarLocation": {
        "jupyter-notebook": "hidden"
    }

VS Code

image

Chrome/Jupyter Notebook
image

@kolibril13 do you wanna give the settings a try and see how they work for you?

@rebornix
Copy link
Member

I pushed this a bit more by

  • moving the global toolbar to the editor toolbar
  • changing the editor line height to be the same as Jupyter Notebook (17px)

and I actually get slightly more content rendered than Jupyter Notebook ;). It's not fair comparison as the browser renders the omnitoolbar and Jupyter Notebook renders a menubar (while VS Code's menus are in the system menubar)

image

and here are all the notebook settings I tweaked

    "editor.lineHeight": 17,
    "breadcrumbs.enabled": false,
    "notebook.insertToolbarLocation": "notebookToolbar",
    "notebook.showCellStatusBar": "hidden",
    "notebook.cellToolbarLocation": {
        "jupyter-notebook": "hidden"
    },
    "notebook.globalToolbar": false,
    "notebook.experimental.outputScrolling": true,
    "notebook.consolidatedRunButton": true,

@rebornix rebornix added this to the Backlog milestone Feb 24, 2023
@kolibril13
Copy link
Author

kolibril13 commented Feb 24, 2023

Thanks @rebornix for your quick response and so many great suggestions!
And congrats for winning the "more content rendered than in Jupyter Lab" challenge with VSCode! ;)

I think it's really situation dependent when one prefers more functions, and when one prefers more space.
Maybe there can be a switch command that toggles all these settings at once?

Regarding from your comment above:

A toolbar to insert between cells
A breadcrumb to show the TOC of the notebook file and cell
Cell toolbar which allows you to run operations against the target cell

I totally agree with this, these are nice to have, but also dispensable as there are good alternatives.

Cell status bar for execution state and cell language

In my opinion, the execution state is an important feature.
Maybe this can be shifted up in "tight layout" mode, so that it does not occupy extra vertical space?
In JupyterLab, there is the [*] that indicates cell execution.
And the cell language: How about shifting this to the right bottom corner of the last code line in "tight layout" mode?
But cell language is also not very important to have in a "tight layout" mode, I think.

I've tested your parameters, and it's a huge difference! Thanks a lot for providing these settings! :)
Here is a before/after image comparison:

Screen.Recording.2023-02-24.at.20.40.58.mov




Do we want to take this challenge even further and once test out the tightest vertical spacing that does not harm the readability?

I just took your reduced spaced layout and drew some red lines where I can see potential to further reduce the size:

  • A few pixels less at the beginning of a cell.
  • A few pixels less at the ending of a cell.
  • A few pixel less between the outputs.

Maybe it might look cluttered then, but it would be interesting to see if this was possible.

image

@rebornix
Copy link
Member

@kolibril13 I like the screenshot you posted above very much. You did figure out the padding we added around those components, great work!

A few pixels less at the beginning of a cell.
A few pixels less at the ending of a cell.

We always add a few pixels around the cell editor. The text editor has settings to control the top/bottom padding, so we might consider adding the same set of settings for notebook.

A few pixel less between the outputs.

We might want to check the default padding we use for outputs cc @amunger

@john012343210
Copy link

@kolibril13 I like the screenshot you posted above very much. You did figure out the padding we added around those components, great work!

A few pixels less at the beginning of a cell.
A few pixels less at the ending of a cell.

We always add a few pixels around the cell editor. The text editor has settings to control the top/bottom padding, so we might consider adding the same set of settings for notebook.

A few pixel less between the outputs.

We might want to check the default padding we use for outputs cc @amunger

Any updates on these features?

@YubinXie
Copy link

YubinXie commented Nov 3, 2023

I find switching this setting to hidden helps the most.
image

@starball5
Copy link

Historically related: #101366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality notebook-layout
Projects
None yet
Development

No branches or pull requests

7 participants
@rebornix @amunger @YubinXie @john012343210 @kolibril13 @starball5 and others