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

Interactive window- don't leave space for insert toolbar #181949

Merged
merged 4 commits into from
May 10, 2023

Conversation

r3m0t
Copy link
Contributor

@r3m0t r3m0t commented May 9, 2023

Interactive window is more compact than Notebook now, by not leaving space for the insert cell toolbar(which has no items anyway in the interactive window)

This is cleaned up from #164760

@r3m0t
Copy link
Contributor Author

r3m0t commented May 9, 2023

@amunger I have cleaned up my previous PR you reviewed a long while ago. Could you take a look?

amunger
amunger previously approved these changes May 9, 2023
@@ -145,7 +145,7 @@ export class NotebookOptions extends Disposable {
const cellToolbarInteraction = overrides?.cellToolbarInteraction ?? this.configurationService.getValue<string>(NotebookSetting.cellToolbarVisibility);
const compactView = this.configurationService.getValue<boolean | undefined>(NotebookSetting.compactView) ?? true;
const focusIndicator = this._computeFocusIndicatorOption();
const insertToolbarPosition = this._computeInsertToolbarPositionOption();
const insertToolbarBetweenCells = overrides?.insertToolbarBetweenCells ?? this._computeInsertToolbarBetweenCellsOption();
Copy link
Member

Choose a reason for hiding this comment

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

should we check if the notebook document is readonly or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it is a bigger change now but it looks great. I used Show Contents on local history timeline/git timeline to see a readonly jupyter notebook.

Copy link
Contributor

Choose a reason for hiding this comment

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

insertToolbarBetweenCells should be set to false here if the notebook is readonly. That would eliminate the need to pass around the readonly parameter in all those other methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That information comes from the model, NotebookEditorWidget doesn't have the model in its constructor, only later when NotebookEditorWidget.setModel is called (which can be done multiple times)

Here's the call stack when using Show Contents on a git revision (creationOptions is { menuIds: {... }, cellEditorContributions: [ ...] })

image

Then setModel-
image

Then setOptions with isReadOnly set-

image

bottomToolbarGap: 0,
bottomToolbarHeight: 0
} : {
bottomToolbarGap: 12,
Copy link
Contributor Author

@r3m0t r3m0t May 10, 2023

Choose a reason for hiding this comment

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

this is enough gap for the cellToolbar to have a gap between the top of the toolbar and the editor outline of the previous cell (in the case the previous cell has no output)

@r3m0t r3m0t force-pushed the interactive-window-compact-b branch from 17434cd to 761a1d3 Compare May 10, 2023 15:20
@r3m0t r3m0t requested a review from rebornix May 10, 2023 15:21
@amunger amunger merged commit 46b7e7b into microsoft:main May 10, 2023
@r3m0t
Copy link
Contributor Author

r3m0t commented May 10, 2023

Thanks @amunger, users at my workplace will be very happy. During the change, I noticed #182120 as well.

@rebornix rebornix added this to the May 2023 milestone May 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2023
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.

None yet

4 participants