-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -0,0 +1,39 @@ | |||
const MIN_HEIGHT = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this global?
There was a problem hiding this comment.
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 100
s corresponded to that change?" and consolidating them in to logical groups if you have multiple instances
|
||
if (prevHeight !== Math.max(MIN_HEIGHT, height)) { | ||
prevHeight = Math.max(MIN_HEIGHT, height) | ||
editorElement.style.height = `${height}px` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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