@codemirror/language 0.20.2 → 6.2.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/.github/workflows/dispatch.yml +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +5 -5
- package/dist/index.cjs +62 -6
- package/dist/index.d.ts +25 -4
- package/dist/index.js +61 -7
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 6.2.0 (2022-06-30)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a bug that prevented bracket matching to recognize plain brackets inside a language parsed as an overlay.
|
|
6
|
+
|
|
7
|
+
### New features
|
|
8
|
+
|
|
9
|
+
The `indentRange` function provides an easy way to programatically auto-indent a range of the document.
|
|
10
|
+
|
|
11
|
+
## 6.1.0 (2022-06-20)
|
|
12
|
+
|
|
13
|
+
### New features
|
|
14
|
+
|
|
15
|
+
The `foldState` field is now public, and can be used to serialize and deserialize the fold state.
|
|
16
|
+
|
|
17
|
+
## 6.0.0 (2022-06-08)
|
|
18
|
+
|
|
19
|
+
### New features
|
|
20
|
+
|
|
21
|
+
The `foldingChanged` option to `foldGutter` can now be used to trigger a recomputation of the fold markers.
|
|
22
|
+
|
|
1
23
|
## 0.20.2 (2022-05-20)
|
|
2
24
|
|
|
3
25
|
### Bug fixes
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @codemirror/language [](https://www.npmjs.org/package/@codemirror/language)
|
|
2
2
|
|
|
3
|
-
[ [**WEBSITE**](https://codemirror.net/
|
|
3
|
+
[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#language) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/language/blob/main/CHANGELOG.md) ]
|
|
4
4
|
|
|
5
5
|
This package implements the language support infrastructure for the
|
|
6
|
-
[CodeMirror](https://codemirror.net/
|
|
6
|
+
[CodeMirror](https://codemirror.net/) code editor.
|
|
7
7
|
|
|
8
|
-
The [project page](https://codemirror.net/
|
|
9
|
-
number of [examples](https://codemirror.net/
|
|
10
|
-
[documentation](https://codemirror.net/
|
|
8
|
+
The [project page](https://codemirror.net/) has more information, a
|
|
9
|
+
number of [examples](https://codemirror.net/examples/) and the
|
|
10
|
+
[documentation](https://codemirror.net/docs/).
|
|
11
11
|
|
|
12
12
|
This code is released under an
|
|
13
13
|
[MIT license](https://github.com/codemirror/language/tree/main/LICENSE).
|
package/dist/index.cjs
CHANGED
|
@@ -616,7 +616,10 @@ const parseWorker = view.ViewPlugin.fromClass(class ParseWorker {
|
|
|
616
616
|
eventHandlers: { focus() { this.scheduleWork(); } }
|
|
617
617
|
});
|
|
618
618
|
/**
|
|
619
|
-
The facet used to associate a language with an editor state.
|
|
619
|
+
The facet used to associate a language with an editor state. Used
|
|
620
|
+
by `Language` object's `extension` property (so you don't need to
|
|
621
|
+
manually wrap your languages in this). Can be used to access the
|
|
622
|
+
current language on a state.
|
|
620
623
|
*/
|
|
621
624
|
const language = state.Facet.define({
|
|
622
625
|
combine(languages) { return languages.length ? languages[0] : null; },
|
|
@@ -815,6 +818,31 @@ function getIndentation(context, pos) {
|
|
|
815
818
|
return tree ? syntaxIndentation(context, tree, pos) : null;
|
|
816
819
|
}
|
|
817
820
|
/**
|
|
821
|
+
Create a change set that auto-indents all lines touched by the
|
|
822
|
+
given document range.
|
|
823
|
+
*/
|
|
824
|
+
function indentRange(state, from, to) {
|
|
825
|
+
let updated = Object.create(null);
|
|
826
|
+
let context = new IndentContext(state, { overrideIndentation: start => { var _a; return (_a = updated[start]) !== null && _a !== void 0 ? _a : -1; } });
|
|
827
|
+
let changes = [];
|
|
828
|
+
for (let pos = from; pos <= to;) {
|
|
829
|
+
let line = state.doc.lineAt(pos);
|
|
830
|
+
let indent = getIndentation(context, line.from);
|
|
831
|
+
if (indent == null)
|
|
832
|
+
continue;
|
|
833
|
+
if (!/\S/.test(line.text))
|
|
834
|
+
indent = 0;
|
|
835
|
+
let cur = /^\s*/.exec(line.text)[0];
|
|
836
|
+
let norm = indentString(state, indent);
|
|
837
|
+
if (cur != norm) {
|
|
838
|
+
updated[line.from] = indent;
|
|
839
|
+
changes.push({ from: line.from, to: line.from + cur.length, insert: norm });
|
|
840
|
+
}
|
|
841
|
+
pos = line.to + 1;
|
|
842
|
+
}
|
|
843
|
+
return state.changes(changes);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
818
846
|
Indentation contexts are used when calling [indentation
|
|
819
847
|
services](https://codemirror.net/6/docs/ref/#language.indentService). They provide helper utilities
|
|
820
848
|
useful in indentation logic, and can selectively override the
|
|
@@ -1204,6 +1232,13 @@ function selectedLines(view) {
|
|
|
1204
1232
|
}
|
|
1205
1233
|
return lines;
|
|
1206
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
The state field that stores the folded ranges (as a [decoration
|
|
1237
|
+
set](https://codemirror.net/6/docs/ref/#view.DecorationSet)). Can be passed to
|
|
1238
|
+
[`EditorState.toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) and
|
|
1239
|
+
[`fromJSON`](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) to serialize the fold
|
|
1240
|
+
state.
|
|
1241
|
+
*/
|
|
1207
1242
|
const foldState = state.StateField.define({
|
|
1208
1243
|
create() {
|
|
1209
1244
|
return view.Decoration.none;
|
|
@@ -1231,7 +1266,24 @@ const foldState = state.StateField.define({
|
|
|
1231
1266
|
}
|
|
1232
1267
|
return folded;
|
|
1233
1268
|
},
|
|
1234
|
-
provide: f => view.EditorView.decorations.from(f)
|
|
1269
|
+
provide: f => view.EditorView.decorations.from(f),
|
|
1270
|
+
toJSON(folded, state) {
|
|
1271
|
+
let ranges = [];
|
|
1272
|
+
folded.between(0, state.doc.length, (from, to) => { ranges.push(from, to); });
|
|
1273
|
+
return ranges;
|
|
1274
|
+
},
|
|
1275
|
+
fromJSON(value) {
|
|
1276
|
+
if (!Array.isArray(value) || value.length % 2)
|
|
1277
|
+
throw new RangeError("Invalid JSON for fold state");
|
|
1278
|
+
let ranges = [];
|
|
1279
|
+
for (let i = 0; i < value.length;) {
|
|
1280
|
+
let from = value[i++], to = value[i++];
|
|
1281
|
+
if (typeof from != "number" || typeof to != "number")
|
|
1282
|
+
throw new RangeError("Invalid JSON for fold state");
|
|
1283
|
+
ranges.push(foldWidget.range(from, to));
|
|
1284
|
+
}
|
|
1285
|
+
return view.Decoration.set(ranges, true);
|
|
1286
|
+
}
|
|
1235
1287
|
});
|
|
1236
1288
|
/**
|
|
1237
1289
|
Get a [range set](https://codemirror.net/6/docs/ref/#state.RangeSet) containing the folded ranges
|
|
@@ -1380,6 +1432,7 @@ const foldGutterDefaults = {
|
|
|
1380
1432
|
closedText: "›",
|
|
1381
1433
|
markerDOM: null,
|
|
1382
1434
|
domEventHandlers: {},
|
|
1435
|
+
foldingChanged: () => false
|
|
1383
1436
|
};
|
|
1384
1437
|
class FoldMarker extends view.GutterMarker {
|
|
1385
1438
|
constructor(config, open) {
|
|
@@ -1414,7 +1467,8 @@ function foldGutter(config = {}) {
|
|
|
1414
1467
|
if (update.docChanged || update.viewportChanged ||
|
|
1415
1468
|
update.startState.facet(language) != update.state.facet(language) ||
|
|
1416
1469
|
update.startState.field(foldState, false) != update.state.field(foldState, false) ||
|
|
1417
|
-
syntaxTree(update.startState) != syntaxTree(update.state)
|
|
1470
|
+
syntaxTree(update.startState) != syntaxTree(update.state) ||
|
|
1471
|
+
fullConfig.foldingChanged(update))
|
|
1418
1472
|
this.markers = this.buildMarkers(update.view);
|
|
1419
1473
|
}
|
|
1420
1474
|
buildMarkers(view) {
|
|
@@ -1770,7 +1824,7 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
1770
1824
|
let basePos = pos + distance * dir;
|
|
1771
1825
|
for (let pos = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos != end; pos += dir) {
|
|
1772
1826
|
let found = brackets.indexOf(text[pos]);
|
|
1773
|
-
if (found < 0 || tree.
|
|
1827
|
+
if (found < 0 || tree.resolveInner(basePos + pos, 1).type != tokenType)
|
|
1774
1828
|
continue;
|
|
1775
1829
|
if ((found % 2 == 0) == (dir > 0)) {
|
|
1776
1830
|
depth++;
|
|
@@ -2247,8 +2301,8 @@ for (let [legacyName, name] of [
|
|
|
2247
2301
|
["variable-2", "variableName.special"],
|
|
2248
2302
|
["string-2", "string.special"],
|
|
2249
2303
|
["def", "variableName.definition"],
|
|
2250
|
-
["tag", "
|
|
2251
|
-
["attribute", "
|
|
2304
|
+
["tag", "tagName"],
|
|
2305
|
+
["attribute", "attributeName"],
|
|
2252
2306
|
["type", "typeName"],
|
|
2253
2307
|
["builtin", "variableName.standard"],
|
|
2254
2308
|
["qualifier", "modifier"],
|
|
@@ -2335,6 +2389,7 @@ exports.foldInside = foldInside;
|
|
|
2335
2389
|
exports.foldKeymap = foldKeymap;
|
|
2336
2390
|
exports.foldNodeProp = foldNodeProp;
|
|
2337
2391
|
exports.foldService = foldService;
|
|
2392
|
+
exports.foldState = foldState;
|
|
2338
2393
|
exports.foldable = foldable;
|
|
2339
2394
|
exports.foldedRanges = foldedRanges;
|
|
2340
2395
|
exports.forceParsing = forceParsing;
|
|
@@ -2343,6 +2398,7 @@ exports.getIndentation = getIndentation;
|
|
|
2343
2398
|
exports.highlightingFor = highlightingFor;
|
|
2344
2399
|
exports.indentNodeProp = indentNodeProp;
|
|
2345
2400
|
exports.indentOnInput = indentOnInput;
|
|
2401
|
+
exports.indentRange = indentRange;
|
|
2346
2402
|
exports.indentService = indentService;
|
|
2347
2403
|
exports.indentString = indentString;
|
|
2348
2404
|
exports.indentUnit = indentUnit;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NodeProp, Parser, Tree, TreeFragment, SyntaxNode, NodeType } from '@lezer/common';
|
|
2
2
|
import { LRParser, ParserConfig } from '@lezer/lr';
|
|
3
3
|
import * as _codemirror_state from '@codemirror/state';
|
|
4
|
-
import { Facet, Extension, EditorState, Range } from '@codemirror/state';
|
|
5
|
-
import { EditorView, DecorationSet, Command, KeyBinding, BlockInfo, Decoration } from '@codemirror/view';
|
|
4
|
+
import { Facet, Extension, EditorState, StateField, Range } from '@codemirror/state';
|
|
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
|
|
|
@@ -214,7 +214,10 @@ declare class ParseContext {
|
|
|
214
214
|
static get(): ParseContext | null;
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
|
-
The facet used to associate a language with an editor state.
|
|
217
|
+
The facet used to associate a language with an editor state. Used
|
|
218
|
+
by `Language` object's `extension` property (so you don't need to
|
|
219
|
+
manually wrap your languages in this). Can be used to access the
|
|
220
|
+
current language on a state.
|
|
218
221
|
*/
|
|
219
222
|
declare const language: Facet<Language, Language | null>;
|
|
220
223
|
/**
|
|
@@ -380,6 +383,11 @@ be determined, and null otherwise.
|
|
|
380
383
|
*/
|
|
381
384
|
declare function getIndentation(context: IndentContext | EditorState, pos: number): number | null;
|
|
382
385
|
/**
|
|
386
|
+
Create a change set that auto-indents all lines touched by the
|
|
387
|
+
given document range.
|
|
388
|
+
*/
|
|
389
|
+
declare function indentRange(state: EditorState, from: number, to: number): _codemirror_state.ChangeSet;
|
|
390
|
+
/**
|
|
383
391
|
Indentation contexts are used when calling [indentation
|
|
384
392
|
services](https://codemirror.net/6/docs/ref/#language.indentService). They provide helper utilities
|
|
385
393
|
useful in indentation logic, and can selectively override the
|
|
@@ -617,6 +625,14 @@ State effect that unfolds the given range (if it was folded).
|
|
|
617
625
|
*/
|
|
618
626
|
declare const unfoldEffect: _codemirror_state.StateEffectType<DocRange>;
|
|
619
627
|
/**
|
|
628
|
+
The state field that stores the folded ranges (as a [decoration
|
|
629
|
+
set](https://codemirror.net/6/docs/ref/#view.DecorationSet)). Can be passed to
|
|
630
|
+
[`EditorState.toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) and
|
|
631
|
+
[`fromJSON`](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) to serialize the fold
|
|
632
|
+
state.
|
|
633
|
+
*/
|
|
634
|
+
declare const foldState: StateField<DecorationSet>;
|
|
635
|
+
/**
|
|
620
636
|
Get a [range set](https://codemirror.net/6/docs/ref/#state.RangeSet) containing the folded ranges
|
|
621
637
|
in the given state.
|
|
622
638
|
*/
|
|
@@ -698,6 +714,11 @@ interface FoldGutterConfig {
|
|
|
698
714
|
Supply event handlers for DOM events on this gutter.
|
|
699
715
|
*/
|
|
700
716
|
domEventHandlers?: Handlers;
|
|
717
|
+
/**
|
|
718
|
+
When given, if this returns true for a given view update,
|
|
719
|
+
recompute the fold markers.
|
|
720
|
+
*/
|
|
721
|
+
foldingChanged?: (update: ViewUpdate) => boolean;
|
|
701
722
|
}
|
|
702
723
|
/**
|
|
703
724
|
Create an extension that registers a fold gutter, which shows a
|
|
@@ -1056,4 +1077,4 @@ declare class StreamLanguage<State> extends Language {
|
|
|
1056
1077
|
get allowsNesting(): boolean;
|
|
1057
1078
|
}
|
|
1058
1079
|
|
|
1059
|
-
export { Config, HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, MatchResult, ParseContext, StreamLanguage, StreamParser, StringStream, TagStyle, TreeIndentContext, bracketMatching, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, unfoldAll, unfoldCode, unfoldEffect };
|
|
1080
|
+
export { Config, HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, MatchResult, ParseContext, StreamLanguage, StreamParser, StringStream, TagStyle, TreeIndentContext, bracketMatching, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentRange, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, unfoldAll, unfoldCode, unfoldEffect };
|
package/dist/index.js
CHANGED
|
@@ -612,7 +612,10 @@ const parseWorker = /*@__PURE__*/ViewPlugin.fromClass(class ParseWorker {
|
|
|
612
612
|
eventHandlers: { focus() { this.scheduleWork(); } }
|
|
613
613
|
});
|
|
614
614
|
/**
|
|
615
|
-
The facet used to associate a language with an editor state.
|
|
615
|
+
The facet used to associate a language with an editor state. Used
|
|
616
|
+
by `Language` object's `extension` property (so you don't need to
|
|
617
|
+
manually wrap your languages in this). Can be used to access the
|
|
618
|
+
current language on a state.
|
|
616
619
|
*/
|
|
617
620
|
const language = /*@__PURE__*/Facet.define({
|
|
618
621
|
combine(languages) { return languages.length ? languages[0] : null; },
|
|
@@ -811,6 +814,31 @@ function getIndentation(context, pos) {
|
|
|
811
814
|
return tree ? syntaxIndentation(context, tree, pos) : null;
|
|
812
815
|
}
|
|
813
816
|
/**
|
|
817
|
+
Create a change set that auto-indents all lines touched by the
|
|
818
|
+
given document range.
|
|
819
|
+
*/
|
|
820
|
+
function indentRange(state, from, to) {
|
|
821
|
+
let updated = Object.create(null);
|
|
822
|
+
let context = new IndentContext(state, { overrideIndentation: start => { var _a; return (_a = updated[start]) !== null && _a !== void 0 ? _a : -1; } });
|
|
823
|
+
let changes = [];
|
|
824
|
+
for (let pos = from; pos <= to;) {
|
|
825
|
+
let line = state.doc.lineAt(pos);
|
|
826
|
+
let indent = getIndentation(context, line.from);
|
|
827
|
+
if (indent == null)
|
|
828
|
+
continue;
|
|
829
|
+
if (!/\S/.test(line.text))
|
|
830
|
+
indent = 0;
|
|
831
|
+
let cur = /^\s*/.exec(line.text)[0];
|
|
832
|
+
let norm = indentString(state, indent);
|
|
833
|
+
if (cur != norm) {
|
|
834
|
+
updated[line.from] = indent;
|
|
835
|
+
changes.push({ from: line.from, to: line.from + cur.length, insert: norm });
|
|
836
|
+
}
|
|
837
|
+
pos = line.to + 1;
|
|
838
|
+
}
|
|
839
|
+
return state.changes(changes);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
814
842
|
Indentation contexts are used when calling [indentation
|
|
815
843
|
services](https://codemirror.net/6/docs/ref/#language.indentService). They provide helper utilities
|
|
816
844
|
useful in indentation logic, and can selectively override the
|
|
@@ -1200,6 +1228,13 @@ function selectedLines(view) {
|
|
|
1200
1228
|
}
|
|
1201
1229
|
return lines;
|
|
1202
1230
|
}
|
|
1231
|
+
/**
|
|
1232
|
+
The state field that stores the folded ranges (as a [decoration
|
|
1233
|
+
set](https://codemirror.net/6/docs/ref/#view.DecorationSet)). Can be passed to
|
|
1234
|
+
[`EditorState.toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) and
|
|
1235
|
+
[`fromJSON`](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) to serialize the fold
|
|
1236
|
+
state.
|
|
1237
|
+
*/
|
|
1203
1238
|
const foldState = /*@__PURE__*/StateField.define({
|
|
1204
1239
|
create() {
|
|
1205
1240
|
return Decoration.none;
|
|
@@ -1227,7 +1262,24 @@ const foldState = /*@__PURE__*/StateField.define({
|
|
|
1227
1262
|
}
|
|
1228
1263
|
return folded;
|
|
1229
1264
|
},
|
|
1230
|
-
provide: f => EditorView.decorations.from(f)
|
|
1265
|
+
provide: f => EditorView.decorations.from(f),
|
|
1266
|
+
toJSON(folded, state) {
|
|
1267
|
+
let ranges = [];
|
|
1268
|
+
folded.between(0, state.doc.length, (from, to) => { ranges.push(from, to); });
|
|
1269
|
+
return ranges;
|
|
1270
|
+
},
|
|
1271
|
+
fromJSON(value) {
|
|
1272
|
+
if (!Array.isArray(value) || value.length % 2)
|
|
1273
|
+
throw new RangeError("Invalid JSON for fold state");
|
|
1274
|
+
let ranges = [];
|
|
1275
|
+
for (let i = 0; i < value.length;) {
|
|
1276
|
+
let from = value[i++], to = value[i++];
|
|
1277
|
+
if (typeof from != "number" || typeof to != "number")
|
|
1278
|
+
throw new RangeError("Invalid JSON for fold state");
|
|
1279
|
+
ranges.push(foldWidget.range(from, to));
|
|
1280
|
+
}
|
|
1281
|
+
return Decoration.set(ranges, true);
|
|
1282
|
+
}
|
|
1231
1283
|
});
|
|
1232
1284
|
/**
|
|
1233
1285
|
Get a [range set](https://codemirror.net/6/docs/ref/#state.RangeSet) containing the folded ranges
|
|
@@ -1376,6 +1428,7 @@ const foldGutterDefaults = {
|
|
|
1376
1428
|
closedText: "›",
|
|
1377
1429
|
markerDOM: null,
|
|
1378
1430
|
domEventHandlers: {},
|
|
1431
|
+
foldingChanged: () => false
|
|
1379
1432
|
};
|
|
1380
1433
|
class FoldMarker extends GutterMarker {
|
|
1381
1434
|
constructor(config, open) {
|
|
@@ -1410,7 +1463,8 @@ function foldGutter(config = {}) {
|
|
|
1410
1463
|
if (update.docChanged || update.viewportChanged ||
|
|
1411
1464
|
update.startState.facet(language) != update.state.facet(language) ||
|
|
1412
1465
|
update.startState.field(foldState, false) != update.state.field(foldState, false) ||
|
|
1413
|
-
syntaxTree(update.startState) != syntaxTree(update.state)
|
|
1466
|
+
syntaxTree(update.startState) != syntaxTree(update.state) ||
|
|
1467
|
+
fullConfig.foldingChanged(update))
|
|
1414
1468
|
this.markers = this.buildMarkers(update.view);
|
|
1415
1469
|
}
|
|
1416
1470
|
buildMarkers(view) {
|
|
@@ -1766,7 +1820,7 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
1766
1820
|
let basePos = pos + distance * dir;
|
|
1767
1821
|
for (let pos = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos != end; pos += dir) {
|
|
1768
1822
|
let found = brackets.indexOf(text[pos]);
|
|
1769
|
-
if (found < 0 || tree.
|
|
1823
|
+
if (found < 0 || tree.resolveInner(basePos + pos, 1).type != tokenType)
|
|
1770
1824
|
continue;
|
|
1771
1825
|
if ((found % 2 == 0) == (dir > 0)) {
|
|
1772
1826
|
depth++;
|
|
@@ -2243,8 +2297,8 @@ for (let [legacyName, name] of [
|
|
|
2243
2297
|
["variable-2", "variableName.special"],
|
|
2244
2298
|
["string-2", "string.special"],
|
|
2245
2299
|
["def", "variableName.definition"],
|
|
2246
|
-
["tag", "
|
|
2247
|
-
["attribute", "
|
|
2300
|
+
["tag", "tagName"],
|
|
2301
|
+
["attribute", "attributeName"],
|
|
2248
2302
|
["type", "typeName"],
|
|
2249
2303
|
["builtin", "variableName.standard"],
|
|
2250
2304
|
["qualifier", "modifier"],
|
|
@@ -2305,4 +2359,4 @@ function docID(data) {
|
|
|
2305
2359
|
return type;
|
|
2306
2360
|
}
|
|
2307
2361
|
|
|
2308
|
-
export { HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, ParseContext, StreamLanguage, StringStream, TreeIndentContext, bracketMatching, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, unfoldAll, unfoldCode, unfoldEffect };
|
|
2362
|
+
export { HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, ParseContext, StreamLanguage, StringStream, TreeIndentContext, bracketMatching, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentRange, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, unfoldAll, unfoldCode, unfoldEffect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemirror/language",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.2.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",
|