@codemirror/language 0.20.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +3 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1380,6 +1380,7 @@ const foldGutterDefaults = {
|
|
|
1380
1380
|
closedText: "›",
|
|
1381
1381
|
markerDOM: null,
|
|
1382
1382
|
domEventHandlers: {},
|
|
1383
|
+
foldingChanged: () => false
|
|
1383
1384
|
};
|
|
1384
1385
|
class FoldMarker extends view.GutterMarker {
|
|
1385
1386
|
constructor(config, open) {
|
|
@@ -1414,7 +1415,8 @@ function foldGutter(config = {}) {
|
|
|
1414
1415
|
if (update.docChanged || update.viewportChanged ||
|
|
1415
1416
|
update.startState.facet(language) != update.state.facet(language) ||
|
|
1416
1417
|
update.startState.field(foldState, false) != update.state.field(foldState, false) ||
|
|
1417
|
-
syntaxTree(update.startState) != syntaxTree(update.state)
|
|
1418
|
+
syntaxTree(update.startState) != syntaxTree(update.state) ||
|
|
1419
|
+
fullConfig.foldingChanged(update))
|
|
1418
1420
|
this.markers = this.buildMarkers(update.view);
|
|
1419
1421
|
}
|
|
1420
1422
|
buildMarkers(view) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { NodeProp, Parser, Tree, TreeFragment, SyntaxNode, NodeType } from '@lez
|
|
|
2
2
|
import { LRParser, ParserConfig } from '@lezer/lr';
|
|
3
3
|
import * as _codemirror_state from '@codemirror/state';
|
|
4
4
|
import { Facet, Extension, EditorState, Range } from '@codemirror/state';
|
|
5
|
-
import { EditorView, DecorationSet, Command, KeyBinding, BlockInfo, Decoration } from '@codemirror/view';
|
|
5
|
+
import { EditorView, DecorationSet, Command, KeyBinding, ViewUpdate, BlockInfo, Decoration } from '@codemirror/view';
|
|
6
6
|
import { Highlighter, Tag } from '@lezer/highlight';
|
|
7
7
|
import { StyleModule, StyleSpec } from 'style-mod';
|
|
8
8
|
|
|
@@ -698,6 +698,11 @@ interface FoldGutterConfig {
|
|
|
698
698
|
Supply event handlers for DOM events on this gutter.
|
|
699
699
|
*/
|
|
700
700
|
domEventHandlers?: Handlers;
|
|
701
|
+
/**
|
|
702
|
+
When given, if this returns true for a given view update,
|
|
703
|
+
recompute the fold markers.
|
|
704
|
+
*/
|
|
705
|
+
foldingChanged?: (update: ViewUpdate) => boolean;
|
|
701
706
|
}
|
|
702
707
|
/**
|
|
703
708
|
Create an extension that registers a fold gutter, which shows a
|
package/dist/index.js
CHANGED
|
@@ -1376,6 +1376,7 @@ const foldGutterDefaults = {
|
|
|
1376
1376
|
closedText: "›",
|
|
1377
1377
|
markerDOM: null,
|
|
1378
1378
|
domEventHandlers: {},
|
|
1379
|
+
foldingChanged: () => false
|
|
1379
1380
|
};
|
|
1380
1381
|
class FoldMarker extends GutterMarker {
|
|
1381
1382
|
constructor(config, open) {
|
|
@@ -1410,7 +1411,8 @@ function foldGutter(config = {}) {
|
|
|
1410
1411
|
if (update.docChanged || update.viewportChanged ||
|
|
1411
1412
|
update.startState.facet(language) != update.state.facet(language) ||
|
|
1412
1413
|
update.startState.field(foldState, false) != update.state.field(foldState, false) ||
|
|
1413
|
-
syntaxTree(update.startState) != syntaxTree(update.state)
|
|
1414
|
+
syntaxTree(update.startState) != syntaxTree(update.state) ||
|
|
1415
|
+
fullConfig.foldingChanged(update))
|
|
1414
1416
|
this.markers = this.buildMarkers(update.view);
|
|
1415
1417
|
}
|
|
1416
1418
|
buildMarkers(view) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemirror/language",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Language support infrastructure for the CodeMirror code editor",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "cm-runtests",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@codemirror/state": "^0.
|
|
30
|
-
"@codemirror/view": "^0.
|
|
31
|
-
"@lezer/common": "^0.
|
|
32
|
-
"@lezer/highlight": "^0.
|
|
33
|
-
"@lezer/lr": "^0.
|
|
29
|
+
"@codemirror/state": "^6.0.0",
|
|
30
|
+
"@codemirror/view": "^6.0.0",
|
|
31
|
+
"@lezer/common": "^1.0.0",
|
|
32
|
+
"@lezer/highlight": "^1.0.0",
|
|
33
|
+
"@lezer/lr": "^1.0.0",
|
|
34
34
|
"style-mod": "^4.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@codemirror/buildhelper": "^0.1.5",
|
|
38
|
-
"@lezer/javascript": "^0.
|
|
38
|
+
"@lezer/javascript": "^1.0.0"
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|