mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-13 18:14:09 +00:00
editor: lazy load
This makes the required changes needed to make the editor components and sagas lazy-load to improve the time before the first render of the app. This is done by making sure we only import types from the monaco editor module anywhere other than the saga and the component modules and using React.lazy to lazy-load the component and start the sagas. This cuts the main bundle time to less than 1/2 so load time should be over twice as fast now.
This commit is contained in:
committed by
David Lechner
parent
0f56bb7174
commit
c49f37f5e4
@@ -5,7 +5,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { monaco } from 'react-monaco-editor';
|
||||
import type { monaco } from 'react-monaco-editor';
|
||||
|
||||
/** The Pybricks MicroPython language identifier. */
|
||||
export const pybricksMicroPythonId = 'pybricks-micropython';
|
||||
@@ -39,7 +39,7 @@ export const conf: monaco.languages.LanguageConfiguration = {
|
||||
beforeText: new RegExp(
|
||||
'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$',
|
||||
),
|
||||
action: { indentAction: monaco.languages.IndentAction.Indent },
|
||||
action: { indentAction: <monaco.languages.IndentAction.Indent>1 },
|
||||
},
|
||||
],
|
||||
folding: {
|
||||
@@ -361,7 +361,7 @@ export const templateSnippetCompletions = <monaco.languages.CompletionItemProvid
|
||||
.filter((x) => x.label.startsWith(textUntilPosition))
|
||||
.map<monaco.languages.CompletionItem>((x) => ({
|
||||
detail: x.insertText,
|
||||
kind: monaco.languages.CompletionItemKind.Snippet,
|
||||
kind: <monaco.languages.CompletionItemKind.Snippet>27,
|
||||
range,
|
||||
...x,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user