From a71ce27915c3d3819186a679667934014835fa8a Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Tue, 6 Aug 2024 10:08:53 +0200 Subject: [PATCH] Update import Co-Authored-By: Sergio A. Vargas --- frontend/components/CellInput.js | 6 +- .../components/CellInput/lezer_template.js | 4 +- frontend/components/CellInput/mixedParsers.js | 8 +-- frontend/components/CellOutput.js | 4 +- frontend/components/ErrorMessage.js | 2 +- frontend/imports/CodemirrorPlutoSetup.js | 72 +------------------ 6 files changed, 15 insertions(+), 81 deletions(-) diff --git a/frontend/components/CellInput.js b/frontend/components/CellInput.js index 91065a7b9b..b4cfb464c0 100644 --- a/frontend/components/CellInput.js +++ b/frontend/components/CellInput.js @@ -43,7 +43,7 @@ import { } from "../imports/CodemirrorPlutoSetup.js" import { markdown, html as htmlLang, javascript, sqlLang, python, julia_mixed } from "./CellInput/mixedParsers.js" -import { julia_andrey } from "../imports/CodemirrorPlutoSetup.js" +import { julia } from "../imports/CodemirrorPlutoSetup.js" import { pluto_autocomplete } from "./CellInput/pluto_autocomplete.js" import { NotebookpackagesFacet, pkgBubblePlugin } from "./CellInput/pkg_bubble_plugin.js" import { awesome_line_wrapping, get_start_tabs } from "./CellInput/awesome_line_wrapping.js" @@ -142,7 +142,7 @@ export const pluto_syntax_colors = HighlightStyle.define( ], { all: { color: `var(--cm-editor-text-color)` }, - scope: julia_andrey().language, + scope: julia().language, } ) @@ -776,7 +776,7 @@ export const CellInput = ({ ] : [ // - julia_andrey(), + julia(), ]), go_to_definition_plugin, pluto_autocomplete({ diff --git a/frontend/components/CellInput/lezer_template.js b/frontend/components/CellInput/lezer_template.js index c034642452..edfdcaeab5 100644 --- a/frontend/components/CellInput/lezer_template.js +++ b/frontend/components/CellInput/lezer_template.js @@ -1,4 +1,4 @@ -import { julia_andrey, NodeProp, syntaxTree, Text } from "../../imports/CodemirrorPlutoSetup.js" +import { julia, NodeProp, syntaxTree, Text } from "../../imports/CodemirrorPlutoSetup.js" import lodash from "../../imports/lodash.js" // @ts-ignore @@ -9,7 +9,7 @@ import ManyKeysWeakMap from "https://esm.sh/many-keys-weakmap@1.0.0?pin=v113&tar * @returns {SyntaxNode} */ export let julia_to_ast = (julia_code) => { - return /** @type {any} */ (julia_andrey().language.parser.parse(julia_code).topNode.firstChild) + return /** @type {any} */ (julia().language.parser.parse(julia_code).topNode.firstChild) } // When you get errors while creating the templates (stuff related to substitutions), diff --git a/frontend/components/CellInput/mixedParsers.js b/frontend/components/CellInput/mixedParsers.js index da7e00ae7d..11898e0539 100644 --- a/frontend/components/CellInput/mixedParsers.js +++ b/frontend/components/CellInput/mixedParsers.js @@ -12,7 +12,7 @@ import { sql, javascript, python, - julia_andrey, + julia, parseCode, } from "../../imports/CodemirrorPlutoSetup.js" @@ -166,10 +166,10 @@ const juliaWrapper = parseMixed((node, input) => { }) const julia_mixed = (config) => { - const julia = julia_andrey(config) + const julia_simple = julia(config) // @ts-ignore - julia.language.parser = julia.language.parser.configure({ wrap: juliaWrapper }) - return julia + julia_simple.language.parser = julia_simple.language.parser.configure({ wrap: juliaWrapper }) + return julia_simple } export { julia_mixed, sqlLang, pythonLanguage, javascript, htmlLanguage, javascriptLanguage, python, markdown, html } diff --git a/frontend/components/CellOutput.js b/frontend/components/CellOutput.js index 5ee73add66..5484429c69 100644 --- a/frontend/components/CellOutput.js +++ b/frontend/components/CellOutput.js @@ -25,7 +25,7 @@ import { pluto_syntax_colors, ENABLE_CM_MIXED_PARSER } from "./CellInput.js" import hljs from "../imports/highlightjs.js" import { julia_mixed } from "./CellInput/mixedParsers.js" -import { julia_andrey } from "../imports/CodemirrorPlutoSetup.js" +import { julia } from "../imports/CodemirrorPlutoSetup.js" import { SafePreviewSanitizeMessage } from "./SafePreviewUI.js" const prettyAssignee = (assignee) => @@ -680,7 +680,7 @@ export let highlight = (code_element, language) => { syntaxHighlighting(defaultHighlightStyle, { fallback: true }), EditorState.tabSize.of(4), // TODO Other languages possibly? - ...(language === "julia" ? [ENABLE_CM_MIXED_PARSER ? julia_mixed() : julia_andrey()] : []), + ...(language === "julia" ? [ENABLE_CM_MIXED_PARSER ? julia_mixed() : julia()] : []), EditorView.lineWrapping, EditorView.editable.of(false), ].filter((x) => x != null), diff --git a/frontend/components/ErrorMessage.js b/frontend/components/ErrorMessage.js index 91ae58bb13..463ad010ab 100644 --- a/frontend/components/ErrorMessage.js +++ b/frontend/components/ErrorMessage.js @@ -1,6 +1,6 @@ import { cl } from "../common/ClassTable.js" import { PlutoActionsContext } from "../common/PlutoContext.js" -import { EditorState, EditorView, julia_andrey, lineNumbers, syntaxHighlighting } from "../imports/CodemirrorPlutoSetup.js" +import { EditorState, EditorView, julia, lineNumbers, syntaxHighlighting } from "../imports/CodemirrorPlutoSetup.js" import { html, useContext, useEffect, useLayoutEffect, useRef, useState } from "../imports/Preact.js" import { pluto_syntax_colors } from "./CellInput.js" import { highlight } from "./CellOutput.js" diff --git a/frontend/imports/CodemirrorPlutoSetup.js b/frontend/imports/CodemirrorPlutoSetup.js index a207ef132c..bdc95aeea8 100644 --- a/frontend/imports/CodemirrorPlutoSetup.js +++ b/frontend/imports/CodemirrorPlutoSetup.js @@ -1,10 +1,10 @@ -import { +export { EditorState, EditorSelection, Compartment, EditorView, placeholder, - julia_andrey, + julia, keymap, syntaxHighlighting, history, @@ -64,70 +64,4 @@ import { linter, setDiagnostics, //@ts-ignore -} from "https://cdn.jsdelivr.net/gh/JuliaPluto/codemirror-pluto-setup@1234.3.0/dist/index.es.min.js" - -export { - linter, - setDiagnostics, - EditorState, - EditorSelection, - Compartment, - EditorView, - placeholder, - julia_andrey, - keymap, - history, - historyKeymap, - defaultKeymap, - indentMore, - indentLess, - moveLineUp, - moveLineDown, - tags, - HighlightStyle, - lineNumbers, - highlightSpecialChars, - foldGutter, - drawSelection, - indentOnInput, - defaultHighlightStyle, - bracketMatching, - closeBrackets, - rectangularSelection, - highlightSelectionMatches, - closeBracketsKeymap, - searchKeymap, - foldKeymap, - syntaxTree, - syntaxTreeAvailable, - Decoration, - ViewUpdate, - ViewPlugin, - WidgetType, - Facet, - StateField, - StateEffect, - Transaction, - SelectionRange, - indentUnit, - combineConfig, - NodeProp, - autocomplete, - html, - htmlLanguage, - javascriptLanguage, - markdown, - markdownLanguage, - parseCode, - parseMixed, - PostgreSQL, - pythonLanguage, - sql, - syntaxHighlighting, - javascript, - python, - Text, - css, - cssLanguage, - selectNextOccurrence, -} +} from "https://cdn.jsdelivr.net/gh/JuliaPluto/codemirror-pluto-setup@07a6ae6/dist/index.es.min.js"