Precompute tree edits in playground script

This commit is contained in:
Max Brunsfeld 2019-09-23 16:55:52 -07:00
parent 070f11b8bf
commit 9ce3a53427

View file

@ -104,11 +104,12 @@ let tree;
async function handleCodeChange(editor, changes) {
const newText = codeEditor.getValue() + '\n';
const edits = tree && changes && changes.map(treeEditForEditorChange);
const start = performance.now();
if (tree && changes) {
for (const change of changes) {
tree.edit(treeEditForEditorChange(change));
if (edits) {
for (const edit of edits) {
tree.edit(edit);
}
}
const newTree = parser.parse(newText, tree);