-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Use monaco editor #3076
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
base: main
Are you sure you want to change the base?
feat: Use monaco editor #3076
Conversation
👷 Deploy request for babel-next pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for babel ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
js/repl/Monaco.tsx
Outdated
padding: { | ||
top: 2, | ||
}, | ||
theme: "dark-plus", |
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.
Can we set the light theme by default? Ideally it should adapt to the user colour scheme preference.
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.
Since our tabs and options are dark, I prefer to always use a dark theme. :)
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.
The current REPL supports user colour scheme preference. If you prefer dark scheme, the REPL will adapt to the system settings (we should have also migrated the top-right colour scheme switch button to REPL page):
The tabs/options are for the contrast with the editor, it does not mean we should use dark unconditionally: Similar to the landing page: the upper part is always dark
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.
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.
I am all for changing the setting panel accordingly. But to force users with light mode to use dark mode editor is another thing. The current behaviour is that, if the system is in light mode, the editor will be in light mode as well, so as to the dark mode.
On colour mode switch button: If we merge REPL back to a docusuarus page, the global navbar will be reused and we should automatically get the colour switch button. Of course this can be an idea for a new PR. |
Yes I'm trying. |
It was separated when we are migrating to docusuarus 2 so that we can speed up the migration process: #2622 (comment) Now that we are using docusaurus v3 and planing a REPL overhaul, maybe we can try to see if we can move it back and unify the navbar. @nicolo-ribaudo WDYT? |
js/repl/Monaco.tsx
Outdated
model: fastMode | ||
? monaco.editor.createModel( | ||
"", | ||
"javascript", | ||
monaco.Uri.file("output/output.tsx") | ||
) |
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.
This is a somewhat bad hack.
The syntax highlighter registered by shiki will cause performance degradation, which is obvious when using timeTravel
on large files.
And monaco does not support using different syntax highlighters for the same language.
So we set the language of the output code to js
, it will use a worse highlight, and notice that it will not warn even if we output ts.
What do you think about using this solution, or not using it (because it is not very slow, just a little slow), or continuing to use codemirror for output code?
This was tested manually, so let me see if everything works fine after deployment.