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

GH-8361: Fixed editor resizing issue in Output. #8362

Merged
merged 1 commit into from
Aug 18, 2020
Merged

GH-8361: Fixed editor resizing issue in Output. #8362

merged 1 commit into from
Aug 18, 2020

Conversation

kittaakos
Copy link
Contributor

Closes #8361.

Signed-off-by: Akos Kitta kittaakos@typefox.io

What it does

Fixes the editor resizing issue in the Output view.

How to test

  • Make sure the API sample Output channel is visible.
  • Maximize the Problems view,
  • Minimize the Problems view,
  • Switch to the Output view, and
  • Check whether the editor fits the container.

Before:
screencast 2020-08-12 13-22-37

After:
screencast 2020-08-12 13-42-23

Review checklist

Reminder for reviewers

Closes #8361.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
@@ -147,6 +147,11 @@ export class OutputWidget extends BaseWidget implements StatefulWidget {
}
}

protected onAfterShow(msg: Message): void {
super.onAfterShow(msg);
this.onResize(Widget.ResizeMessage.UnknownSize); // Triggers an editor widget resize. (#8361)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what is the difference to explicit this.editor.refresh();.

In EditorWidget we do it, we do it as well for onAfterAttach to resize it if a widget gets moved between areas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I started by calling editor.refresh() but it did not fix the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this.autoSizing is false in the monaco editor, so calling refresh is a NOOP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turned out, calling editor.refresh() does nothing at all when invoked from EditorWidget#onAfterShow. autoSizing is always false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In EditorWidget we do it, we do it as well for onAfterAttach to resize it if a widget gets moved between areas.

I have tried opening, maximizing, and DNDing editors while having breakpoints on both onAfterAttach and onAfterShow in the editor widget:

Neither of them has any effect as the underlying monaco editor's autoresize is a noop.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, somehow related to the old issue? microsoft/monaco-editor#794

@akosyakov akosyakov added the output issues related to the output label Aug 12, 2020
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed that the bug is present on master, and that the following changes resolves the issue using the reproduction steps 👍

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

Works well. Thanks!

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

let's go with it

@kittaakos kittaakos merged commit 9d2dcd0 into master Aug 18, 2020
@kittaakos kittaakos deleted the GH-8361 branch August 18, 2020 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
output issues related to the output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[output] The monaco editor does not resize correctly when other views are maximized
4 participants