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

Rename advanced editor to Ace and add Monaco #736

Merged
merged 4 commits into from Jan 9, 2022

Conversation

HKalbasi
Copy link
Member

This is first phase of #357

It should have zero impact to users (except 2 or 3 kilobytes more download). If people want to use it they should manually opt-in.

Closes #450

@HKalbasi
Copy link
Member Author

@shepmaster Do you disagree with this? Should I close this PR?

Copy link
Member

@shepmaster shepmaster left a comment

Choose a reason for hiding this comment

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

Took a quick pass

@@ -36,7 +36,8 @@ export interface CommonEditorProps {

export enum Editor {
Simple = 'simple',
Advanced = 'advanced',
Copy link
Member

Choose a reason for hiding this comment

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

Doing it this way will require changes to local_storage.ts to preserve people's current selections. If you don't feel like making those changes, you could also leave the value as advanced and solely add monaco.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a migration to local_storage.ts.

ui/frontend/editor/MonacoEditor.tsx Outdated Show resolved Hide resolved
ui/frontend/editor/MonacoEditor.tsx Outdated Show resolved Hide resolved
ui/frontend/editor/MonacoEditor.tsx Outdated Show resolved Hide resolved
const modeId = 'my-rust';

const initMonaco = (monaco: Monaco) => {
monaco.editor.defineTheme('vscode-dark-plus', {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to create our own theme? What isn't provided by upstream?

Copy link
Member Author

Choose a reason for hiding this comment

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

VSCode themes are not compatible with monaco because they use textmate convention for tokens but monaco has its own (funnily, monaco is directly built from vscode source code) so upstream won't provide vscode themes. Original themes are ugly (IMO) and people are more familiar with vscode theme.

That theme is not exactly equal to vscode's dark-plus, but it is close enough and I think it is good for default theme (and user can change theme). But we can remove those nine lines if there is something wrong with them.

ui/frontend/editor/Editor.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,142 @@
export const config = {
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that there's no upstream Rust configuration for Monaco?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is, but I'm not happy with it. Some can be solved in upstream (for example not auto closing ' in lifetimes, or more detailed grammar) and some of changes are related to difference of textmate and monarch tokens so won't be accepted in upstream.

@shepmaster
Copy link
Member

Do you disagree with this? Should I close this PR?

Nope and nope! Life is busy, is all.

@shepmaster
Copy link
Member

Starting from the main branch then checking out this code yields numerous console errors:

[Error] Unexpected keys "aceTheme", "monacoTheme" found in preloadedState argument passed to createStore. Expected to find one of the known reducer keys instead: "browser", "code", "configuration", "crates", "globalConfiguration", "notifications", "output", "page", "position", "selection", "versions". Unexpected keys will be ignored.
	warning (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:57385)
	combination (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:57508)
	dispatch (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:57279)
	createStore (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:57365)
	(anonymous function) (main-87ecf2c008511fddb737.js:7574)
	(anonymous function) (main-87ecf2c008511fddb737.js:7574)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:57641)
	./index.tsx (main-87ecf2c008511fddb737.js:5805)
	__webpack_require__ (main-87ecf2c008511fddb737.js:8356)
	(anonymous function) (main-87ecf2c008511fddb737.js:8677:203)
	(anonymous function) (main-87ecf2c008511fddb737.js:8402)
	(anonymous function) (main-87ecf2c008511fddb737.js:8678)
	Global Code (main-87ecf2c008511fddb737.js:8680)
[Error] Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Editor`.
Editor@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:5084:72
div
div
ResizableArea@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:2970:83
div
Playground@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:3018:85
PageSwitcher@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:2897:72
Router@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:7823:17
Router@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:3223:10
Provider@http://127.0.0.1:5000/assets/vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:51652:19
	printWarning (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:53456)
	error (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:53432)
	jsxWithValidation (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:54491)
	Editor (main-87ecf2c008511fddb737.js:5095:83)
	renderWithHooks (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:39147)
	mountIndeterminateComponent (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:41973)
	beginWork$1 (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:48097)
	performUnitOfWork (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46936)
	workLoopSync (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46864)
	renderRootSync (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46827)
	performSyncWorkOnRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46450)
	scheduleUpdateOnFiber (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46038)
	updateContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49639)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50178)
	unbatchedUpdates (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46588)
	legacyRenderSubtreeIntoContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50177)
	./index.tsx (main-87ecf2c008511fddb737.js:5829)
	__webpack_require__ (main-87ecf2c008511fddb737.js:8356)
	(anonymous function) (main-87ecf2c008511fddb737.js:8677:203)
	(anonymous function) (main-87ecf2c008511fddb737.js:8402)
	(anonymous function) (main-87ecf2c008511fddb737.js:8678)
	Global Code (main-87ecf2c008511fddb737.js:8680)
[Error] Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Editor`.
	createFiberFromTypeAndProps (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49215:209)
	createFiberFromElement (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49243)
	reconcileSingleElement (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:38214)
	reconcileChildFibers (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:38274)
	reconcileChildren (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:41152)
	updateHostComponent (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:41794)
	callCallback (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28107)
	dispatchEvent
	invokeGuardedCallbackDev (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28156)
	invokeGuardedCallback (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28218)
	beginWork$1 (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:48121)
	performUnitOfWork (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46936)
	workLoopSync (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46864)
	renderRootSync (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46827)
	performSyncWorkOnRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46450)
	scheduleUpdateOnFiber (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46038)
	updateContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49639)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50178)
	unbatchedUpdates (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46588)
	legacyRenderSubtreeIntoContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50177)
	./index.tsx (main-87ecf2c008511fddb737.js:5829)
	__webpack_require__ (main-87ecf2c008511fddb737.js:8356)
	(anonymous function) (main-87ecf2c008511fddb737.js:8677:203)
	(anonymous function) (main-87ecf2c008511fddb737.js:8402)
	(anonymous function) (main-87ecf2c008511fddb737.js:8678)
	Global Code (main-87ecf2c008511fddb737.js:8680)
[Error] The above error occurred in the <div> component:

div
Editor@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:5084:72
div
div
ResizableArea@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:2970:83
div
Playground@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:3018:85
PageSwitcher@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:2897:72
Router@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:7823:17
Router@http://127.0.0.1:5000/assets/main-87ecf2c008511fddb737.js:3223:10
Provider@http://127.0.0.1:5000/assets/vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:51652:19

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
	logCapturedError (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:44247)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:44275)
	callCallback (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:36480)
	commitUpdateQueue (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:36501)
	commitLifeCycles (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:44893)
	commitLayoutEffects (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:47583)
	callCallback (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28107)
	dispatchEvent
	invokeGuardedCallbackDev (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28156)
	invokeGuardedCallback (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:28218)
	commitRootImpl (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:47308)
	commitRootImpl
	unstable_runWithPriority (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:59771)
	commitRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:47147)
	performSyncWorkOnRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46486)
	scheduleUpdateOnFiber (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46038)
	updateContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49639)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50178)
	unbatchedUpdates (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46588)
	legacyRenderSubtreeIntoContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50177)
	./index.tsx (main-87ecf2c008511fddb737.js:5829)
	__webpack_require__ (main-87ecf2c008511fddb737.js:8356)
	(anonymous function) (main-87ecf2c008511fddb737.js:8677:203)
	(anonymous function) (main-87ecf2c008511fddb737.js:8402)
	(anonymous function) (main-87ecf2c008511fddb737.js:8678)
	Global Code (main-87ecf2c008511fddb737.js:8680)
[Error] Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Editor`.
	commitRootImpl (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:47432)
	commitRootImpl
	unstable_runWithPriority (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:59771)
	commitRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:47147)
	performSyncWorkOnRoot (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46486)
	scheduleUpdateOnFiber (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46038)
	updateContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:49639)
	(anonymous function) (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50178)
	unbatchedUpdates (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:46588)
	legacyRenderSubtreeIntoContainer (vendors-node_modules_monaco-editor_react_lib_es_index_js-node_modules_common-tags_es_index_js-aa7057-05413890f1af16621ed9.js:50177)
	./index.tsx (main-87ecf2c008511fddb737.js:5829)
	__webpack_require__ (main-87ecf2c008511fddb737.js:8356)
	(anonymous function) (main-87ecf2c008511fddb737.js:8677:203)
	(anonymous function) (main-87ecf2c008511fddb737.js:8402)
	(anonymous function) (main-87ecf2c008511fddb737.js:8678)
	Global Code (main-87ecf2c008511fddb737.js:8680)

@shepmaster
Copy link
Member

This appears to load JS resources from a CDN:

image

Please adjust the imports so that the JS is served by us.

@shepmaster
Copy link
Member

shepmaster commented Sep 28, 2021

There appear to be some commands that won't do anything:

image

Please remove these (and any other inoperable actions) to avoid bugs being filed that they "don't work".

@shepmaster
Copy link
Member

shepmaster commented Sep 28, 2021

Ignore this now-deleted comment — I got confused that the filename contained monaco even though it contains all of the dependencies...

@HKalbasi
Copy link
Member Author

There appear to be some commands that won't do anything

It seems that special commands can't be removed. Whole command palette can be removed, but most of command in it works. Even those commands you mentioned work technically, as they work in vscode. Vscode still shows this command when there is no problem and it does nothing when we click (exactly like here). When we add RA, some problems are added so it comes out of the "always does nothing" mode (still if I find a way to remove commands, I'll remove these commands). So I think keeping command palette is better than removing it completely?

CDN and migration should be solved now.

@shepmaster
Copy link
Member

The Monaco JS and CSS are now served by us, but they aren't being properly fingerprinted:

image

Contrast this with the Ace files:

image

We apply aggressive caching headers (Cache-Control: public, max-age=31536000) to static assets. Effectively, once someone has loaded some of our JS / CSS, then will never request it again. As currently configured, after a Monaco upgrade, some people will not download it and others will, causing hard-to-debug problems.

@HKalbasi
Copy link
Member Author

I added a hash to the folder name. It is suboptimal but monaco-react isn't configurable at that level. And since it is bundled to large files, I think most of them will change in a release.

@shepmaster
Copy link
Member

Why the choice of @monaco-editor/react over react-monaco-editor? What are the pros and cons?

@@ -448,7 +448,7 @@ class AdvancedEditorAsync extends React.Component<AdvancedEditorAsyncProps, Adva
private async requireLibraries() {
return import(
/* webpackChunkName: "advanced-editor" */
'./advanced-editor'
'../advanced-editor'
Copy link
Member

Choose a reason for hiding this comment

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

these should be renamed to remain consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Probably grep for "advanced" — there's AdvancedEditorAsyncState down below as well.

@HKalbasi
Copy link
Member Author

There was something wrong with monaco webpack plugin, IIRC lazy loading was hard (which @monaco-editor/react had builtin). At first I used it (not sure directly or through react-monaco-editor) because it was in the rust analyzer wasm demo but it was bad and I switched to @monaco-editor/react.

@shepmaster
Copy link
Member

Looking at the current lazy-loading, it's super old, from before React's lazy even existed. I went ahead and rewrote that in https://github.com/integer32llc/rust-playground/tree/lazy-suspense. I might take your branch and apply the same logic, switching to react-monaco-editor, to see if that will cause it to be pulled in through the same minification / fingerprinting.

@shepmaster
Copy link
Member

I got something working in https://github.com/integer32llc/rust-playground/tree/ace-monaco:

image

It's a bit bigger than yours, however (1.1 MB vs 815 KB). We do have more control over what features are present, so maybe there's something we don't need?

@shepmaster
Copy link
Member

shepmaster commented Oct 15, 2021

bigger than yours, however (1.1 MB vs 815 KB)

Ah, including Monaco twice will do that. Now it's at 675/713 KB

@HKalbasi
Copy link
Member Author

I was misguided that it won't work with normal webpack dynamic import. Now it is based on your branch.

Ah, including Monaco twice will do that. Now it's at 675/713 KB

I'm still getting bigger bundles. What do you mean by "including twice"?

@shepmaster
Copy link
Member

I'm still getting bigger bundles. What do you mean by "including twice"?

https://github.com/integer32llc/rust-playground/pull/736/files#diff-605f974ae4f9dbb24828440f6c62968f21ab63a029efcef60f59d7ff142bfba9R4703-R4711

There are two versions of monaco-editor. The versions need to be unified.

@shepmaster
Copy link
Member

I've force-pushed to your branch after moving some of the commits around and doing general cleanup.

The files are now fingerprinted or inlined:

image

I also moved all the Ace settings into config.ace and did the same for Monaco.

The next step will be adding some automated UI tests.

@HKalbasi
Copy link
Member Author

Great!

The next step will be adding some automated UI tests.

The ruby ones? I don't know ruby, but I can copy existing ones. Also I'm not sure what need to be tested / can be tested.

@shepmaster
Copy link
Member

The ruby ones? I don't know ruby, but I can copy existing ones

Yes, those. Getting good tests is hard and I'm happy to write those.

I'm not sure what need to be tested / can be tested.

This is the more important part I'll need from you — we don't need to deeply test Monaco itself, but what kinds of things would you do to ensure that it was correctly integrated?

@HKalbasi
Copy link
Member Author

hmm, I think if it types something, run fmt, type some more, change the theme, run the code, then if result and code are as expected, and some color changes, and console is clean, then everything our side should be ok.

Aside monaco, migrations and preserving config in editor switches need test.

@HKalbasi
Copy link
Member Author

HKalbasi commented Jan 8, 2022

@shepmaster ping

@shepmaster
Copy link
Member

@HKalbasi thanks for the ping. I've rebased and added some small tweaks. There's a unit test for the migration and an integration test using Monaco.

Care to pull it locally and see if everything continues to work as you expect?

@shepmaster shepmaster added the CI: approved Allowed access to CI secrets label Jan 9, 2022
@shepmaster shepmaster added CI: approved Allowed access to CI secrets and removed CI: approved Allowed access to CI secrets labels Jan 9, 2022
@HKalbasi
Copy link
Member Author

HKalbasi commented Jan 9, 2022

Everything looks good

@shepmaster shepmaster added CI: approved Allowed access to CI secrets and removed CI: approved Allowed access to CI secrets labels Jan 9, 2022
@shepmaster shepmaster added CI: approved Allowed access to CI secrets and removed CI: approved Allowed access to CI secrets labels Jan 9, 2022
@shepmaster shepmaster added CI: approved Allowed access to CI secrets and removed CI: approved Allowed access to CI secrets labels Jan 9, 2022
@shepmaster shepmaster merged commit 60759af into rust-lang:master Jan 9, 2022
@shepmaster
Copy link
Member

Let’s go!

@lnicola
Copy link
Member

lnicola commented Jan 9, 2022

For anyone who wants to give it a try, this is already live on https://play.rust-lang.org/.

@shepmaster
Copy link
Member

Generally things should always be live <1hour after merging. You may need to aggressively reload the page to break the caching, otherwise waiting an hour or day should work.

@Zerotask
Copy link

Is there a way to set the editor via GET param, e. g. editor=monaco?

@bjorn3
Copy link
Member

bjorn3 commented Jan 31, 2022

I don't think it should be. All configuration options are personal preferences and shouldn't be overridable by playground links if you don't pay attention to the full url.

@lnicola
Copy link
Member

lnicola commented Feb 2, 2022

@HKalbasi do you know if it's possible to implement the Ctrl-Enter shortcut for Run in Monaco?

EDIT: never mind, #769

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: approved Allowed access to CI secrets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using monaco-editor in place of ace
5 participants