Skip to content

Commit

Permalink
Merge pull request #2 from PhilippRaab/update-lezer-and-codemirror
Browse files Browse the repository at this point in the history
Update codemirror and lezer
  • Loading branch information
satchmorun authored Sep 21, 2020
2 parents 777751b + f38e0f8 commit 522f5e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 75 deletions.
23 changes: 4 additions & 19 deletions demo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {EditorView} from "@codemirror/next/view"
import {EditorState} from "@codemirror/next/state"
import {defaultHighlighter} from "@codemirror/next/highlight"
import {lineNumbers} from "@codemirror/next/gutter"
import {keymap} from "@codemirror/next/keymap"
import {baseKeymap} from "@codemirror/next/commands"
import {bracketMatching} from "@codemirror/next/matchbrackets"
import {closeBrackets} from "@codemirror/next/closebrackets"
import {specialChars} from "@codemirror/next/special-chars"
import {foldGutter} from "@codemirror/next/fold"
import { basicSetup, EditorState, EditorView } from '@codemirror/next/basic-setup';

let json = String.raw`{
"literals": [true, false, null],
Expand All @@ -24,12 +15,12 @@ let json = String.raw`{
}
}`

import {parser} from "./dist/index"
import {parser} from "./dist/index.es"
import {Subtree} from "lezer-tree"
import {LezerSyntax, foldNodeProp} from "@codemirror/next/syntax"
import {styleTags} from "@codemirror/next/highlight"

let jsonSyntax = new LezerSyntax(parser.withProps(
let jsonSyntax = LezerSyntax.define(parser.withProps(
foldNodeProp.add({
Array(tree) { return {from: tree.start + 1, to: tree.end - 1} },
Object(tree) { return {from: tree.start + 1, to: tree.end - 1} }
Expand All @@ -46,13 +37,7 @@ let jsonSyntax = new LezerSyntax(parser.withProps(
let view = new EditorView({state: EditorState.create({
doc: json,
extensions: [
lineNumbers(),
defaultHighlighter,
keymap(baseKeymap),
specialChars(),
closeBrackets,
bracketMatching(),
foldGutter(),
basicSetup,
jsonSyntax
]
})})
Expand Down
47 changes: 0 additions & 47 deletions docs/demo.5d883921.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/demo.5d883921.js.map

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.html

This file was deleted.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
"author": "Arun Srinivasan <[email protected]>",
"license": "MIT",
"devDependencies": {
"@codemirror/next": "^0.4.0",
"lezer-generator": "^0.8.4",
"lezer-tree": "^0.8.4",
"mocha": "^7.1.1",
"@codemirror/next": "^0.12.0",
"lezer-generator": "^0.10.5",
"lezer-tree": "^0.10.0",
"mocha": "^8.1.3",
"parcel-bundler": "^1.12.4",
"rollup": "^1.10.0",
"rollup-plugin-node-resolve": "^4.2.3"
"rollup": "^2.27.1",
"rollup-plugin-node-resolve": "^5.2.0"
},
"dependencies": {
"lezer": "^0.8.0"
"lezer": "^0.10.4"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 522f5e4

Please sign in to comment.