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

feat: allow monaco to autogrow #18205

Merged
merged 4 commits into from
May 26, 2020
Merged

feat: allow monaco to autogrow #18205

merged 4 commits into from
May 26, 2020

Conversation

drdelambre
Copy link
Contributor

@drdelambre drdelambre commented May 22, 2020

Kapture 2020-05-22 at 17 26 18

This allows monaco to grow to whatever hight it wants to fill the content, allowing interfaces that grow vertically. Removes minimap and the scrollbar as well, as they dont make sense when you can't scroll

@@ -0,0 +1,39 @@
const MIN_HEIGHT = 100
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make this global?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not global, it's scoped to the module instance. usually if you chose an arbitrary number in your code, you can expect it to change for arbitrary reasons. pulling it out as a constant at the top of a module signals "this is a compile time configuration" and makes it easier to change when the time comes without searching through all the app logic thinking "which one of these 100s corresponded to that change?" and consolidating them in to logical groups if you have multiple instances

@drdelambre drdelambre requested review from a team and asalem1 and removed request for a team May 26, 2020 15:50

if (prevHeight !== Math.max(MIN_HEIGHT, height)) {
prevHeight = Math.max(MIN_HEIGHT, height)
editorElement.style.height = `${height}px`
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be setting the height to the reassigned prevHeight? It doesn't seem like we're using prevHeight anywhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're probably right. lemme double check

@drdelambre drdelambre requested a review from asalem1 May 26, 2020 18:03
@drdelambre drdelambre merged commit cfdfec0 into master May 26, 2020
@drdelambre drdelambre deleted the alex_autogrow branch May 26, 2020 18:39
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.

3 participants