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

Disable CM mixed parser #1940

Merged
merged 4 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions frontend/components/CellInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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 { pluto_autocomplete } from "./CellInput/pluto_autocomplete.js"
import { NotebookpackagesFacet, pkgBubblePlugin } from "./CellInput/pkg_bubble_plugin.js"
import { awesome_line_wrapping } from "./CellInput/awesome_line_wrapping.js"
Expand All @@ -62,6 +63,8 @@ import { commentKeymap } from "./CellInput/comment_mixed_parsers.js"
import { debug_syntax_plugin } from "./CellInput/debug_syntax_plugin.js"
import { ScopeStateField } from "./CellInput/scopestate_statefield.js"

export const ENABLE_CM_MIXED_PARSER = false

export const pluto_syntax_colors = HighlightStyle.define(
[
/* The following three need a specific version of the julia parser, will add that later (still messing with it 😈) */
Expand Down Expand Up @@ -618,14 +621,21 @@ export const CellInput = ({
}),
EditorState.tabSize.of(4),
indentUnit.of("\t"),
julia_mixed(),
markdown({
defaultCodeLanguage: julia_mixed(),
}),
htmlLang(), //Provides tag closing!,
javascript(),
python(),
sqlLang,
...(ENABLE_CM_MIXED_PARSER
? [
julia_mixed(),
markdown({
defaultCodeLanguage: julia_mixed(),
}),
htmlLang(), //Provides tag closing!,
javascript(),
python(),
sqlLang,
]
: [
//
julia_andrey(),
]),
go_to_definition_plugin,
pluto_autocomplete({
request_autocomplete: async ({ text }) => {
Expand Down
5 changes: 3 additions & 2 deletions frontend/components/CellOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import register from "../imports/PreactCustomElement.js"

import { EditorState, EditorView, defaultHighlightStyle } from "../imports/CodemirrorPlutoSetup.js"

import { pluto_syntax_colors } from "./CellInput.js"
import { pluto_syntax_colors, ENABLE_CM_MIXED_PARSER } from "./CellInput.js"
import { useState } from "../imports/Preact.js"

import hljs from "../imports/highlightjs.js"
import { julia_mixed } from "./CellInput/mixedParsers.js"
import { julia_andrey } from "../imports/CodemirrorPlutoSetup.js"

export class CellOutput extends Component {
constructor() {
Expand Down Expand Up @@ -515,7 +516,7 @@ export let highlight = (code_element, language) => {
defaultHighlightStyle.fallback,
EditorState.tabSize.of(4),
// TODO Other languages possibly?
language === "julia" ? julia_mixed() : null,
language === "julia" ? (ENABLE_CM_MIXED_PARSER ? julia_mixed() : julia_andrey()) : null,
EditorView.lineWrapping,
EditorView.editable.of(false),
].filter((x) => x != null),
Expand Down
Loading