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

Revert "chore: update codemirror to v6" #974

Merged
merged 1 commit into from
Jul 18, 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
1,107 changes: 721 additions & 386 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
"changelog": "git cliff v0.0.4..$(git describe --tags $(git rev-list --tags --max-count=1)) --output CHANGELOG.md"
},
"dependencies": {
"@codemirror/commands": "^6.0.1",
"@codemirror/lang-css": "^6.0.0",
"@codemirror/lang-json": "^6.0.0",
"@codemirror/language": "^6.2.0",
"@codemirror/legacy-modes": "^6.1.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.1.0",
"@codemirror/view": "^6.0.3",
"@lezer/highlight": "^1.0.0",
"@sindarius/gcodeviewer": "^2.1.17",
"@codemirror/basic-setup": "^0.19.1",
"@codemirror/highlight": "^0.19.7",
"@codemirror/lang-css": "^0.19.3",
"@codemirror/lang-json": "^0.19.1",
"@codemirror/language": "^0.19.7",
"@codemirror/legacy-modes": "^0.19.0",
"@codemirror/state": "^0.19.6",
"@codemirror/search": "^0.19.6",
"@codemirror/stream-parser": "^0.19.5",
"@codemirror/view": "^0.19.42",
"@sindarius/gcodeviewer": "^3.1.0",
"@types/node": "^16.11.22",
"@types/overlayscrollbars": "^1.12.1",
"axios": "^0.26.0",
"codemirror": "^6.0.1",
"core-js": "^3.16.0",
"echarts": "^5.2.2",
"echarts-gl": "^2.0.8",
Expand Down
7 changes: 3 additions & 4 deletions src/components/inputs/Codemirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import { basicSetup } from 'codemirror'
import { EditorView, keymap } from '@codemirror/view'
import { EditorState } from '@codemirror/state'
import { basicSetup, EditorState } from '@codemirror/basic-setup'
import { mainsailTheme } from '@/plugins/codemirrorTheme'
import { StreamLanguage } from '@codemirror/language'
import { StreamLanguage } from '@codemirror/stream-parser'
import { klipper_config } from '@/plugins/StreamParserKlipperConfig'
import { gcode } from '@/plugins/StreamParserGcode'
import { EditorView, keymap } from '@codemirror/view'
import { indentWithTab } from '@codemirror/commands'
import { json } from '@codemirror/lang-json'
import { css } from '@codemirror/lang-css'
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/StreamParserGcode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StringStream } from '@codemirror/language'
import { StringStream } from '@codemirror/stream-parser'

export const gcode = {
token: function (stream: StringStream, state: StreamParserGcodeState, zeroPos = 0): string | null {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/StreamParserJinja2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
import {StringStream} from "@codemirror/language";
import {StringStream} from "@codemirror/stream-parser";
let keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
"extends", "filter", "endfilter", "firstof", "for",
"endfor", "if", "endif", "ifchanged", "endifchanged",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/StreamParserKlipperConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StreamParser, StringStream } from '@codemirror/language'
import { StreamParser, StringStream } from '@codemirror/stream-parser'
import { gcode } from '@/plugins/StreamParserGcode'

export const klipper_config: StreamParser<any> = {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/StreamParserYaml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StringStream } from '@codemirror/language'
import { StringStream } from '@codemirror/stream-parser'

const cons = ['true', 'false', 'on', 'off', 'yes', 'no']
const keywordRegex = new RegExp('\\b((' + cons.join(')|(') + '))$', 'i')
Expand Down
13 changes: 4 additions & 9 deletions src/plugins/codemirrorTheme.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { EditorView } from '@codemirror/view'
import { Extension } from '@codemirror/state'
import { tags as t } from '@lezer/highlight'
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'
import { HighlightStyle, tags as t } from '@codemirror/highlight'

const ui = {
background: '#1e1e1e',
foreground: '#d4d4d4',
}

const mainsailEditor = EditorView.theme(
export const mainsailEditor = EditorView.theme(
{
'&': {
color: '#d4d4d4',
Expand Down Expand Up @@ -41,7 +40,7 @@ const mainsailEditor = EditorView.theme(
{ dark: true }
)

const mainsailHighlightStyle = HighlightStyle.define([
export const mainsailHighlightStyle = HighlightStyle.define([
{ tag: t.number, color: '#b5cea8' },
{ tag: [t.meta], color: '#d4d4d4' },
{ tag: [t.comment], color: '#6a9955' },
Expand All @@ -52,11 +51,7 @@ const mainsailHighlightStyle = HighlightStyle.define([
{ tag: t.name, color: '#e40', fontWeight: 'bold' },
{ tag: t.propertyName, color: '#e56735' },
])
const fn0 = mainsailHighlightStyle.style
// noinspection JSConstantReassignment
// @ts-ignore
mainsailHighlightStyle.style = (tags) => fn0(tags || [])

/// Extension to enable the Mox theme (both the editor theme and
/// the highlight style).
export const mainsailTheme: Extension = [mainsailEditor, syntaxHighlighting(mainsailHighlightStyle)]
export const mainsailTheme: Extension = [mainsailEditor, mainsailHighlightStyle]