@exercism/codemirror-lang-wren 0.7.2 → 1.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/README.md CHANGED
@@ -14,7 +14,7 @@ This code is released under an
14
14
 
15
15
  ### Language Support + Lezer Grammar
16
16
 
17
- This includes both the CodeMirror `LanguageSupport` and the `LezerLanguage` grammar all bundled into a single small repository with a simple build process.
17
+ This includes both the CodeMirror `LanguageSupport` and the `LRLanguage` grammar all bundled into a single small repository with a simple build process.
18
18
 
19
19
 
20
20
  ### Maintainers
@@ -24,6 +24,14 @@ There is a very rough developer tool in `devtool` that can be used for testing.
24
24
  npm run build-devtool
25
25
  ```
26
26
 
27
+ The parser tests are in `test/cases`, and the completion tests are in
28
+ `test/test-completion.js`. After changing the grammar, run
29
+ `npm run build-grammar` before the tests.
30
+
31
+ ```
32
+ npm test
33
+ ```
34
+
27
35
 
28
36
 
29
37
  ### API Reference
@@ -31,11 +39,12 @@ npm run build-devtool
31
39
  <dt id="user-content-wren">
32
40
  <code>wren() → <a href="https://codemirror.net/6/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
33
41
 
34
- <dd><p>Wren support. Includes snippet completion.</p>
42
+ <dd><p>Wren support. Includes completion of snippets, keywords, core classes,
43
+ the names in scope at the cursor, and methods after a dot.</p>
35
44
  </dd>
36
45
 
37
46
  <dt id="user-content-wrenlanguage">
38
- <code>wrenLanguage: <a href="https://codemirror.net/6/docs/ref#language.LezerLanguage">LezerLanguage</a></code></dt>
47
+ <code>wrenLanguage: <a href="https://codemirror.net/6/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>
39
48
 
40
49
  <dd><p>A language provider based on the Lezer Wren
41
50
  parser provided in this very same package, extended with
@@ -55,3 +64,24 @@ highlighting and indentation information.</p>
55
64
  <dd><p>A collection of simple Wren-related
56
65
  <a href="https://codemirror.net/6/docs/ref/#autocomplete.snippet">snippets</a>.</p>
57
66
  </dd>
67
+
68
+ <dt id="user-content-localcompletionsource">
69
+ <code>localCompletionSource: <a href="https://codemirror.net/6/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
70
+
71
+ <dd><p>Completes the variables, parameters, classes, methods and fields
72
+ that are in scope at the cursor.</p>
73
+ </dd>
74
+
75
+ <dt id="user-content-membercompletionsource">
76
+ <code>memberCompletionSource: <a href="https://codemirror.net/6/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
77
+
78
+ <dd><p>Completes methods after a dot. After a class name, it offers the
79
+ class's static methods and constructors. After any other value, it offers
80
+ the instance methods of the core classes and of the classes in the file.</p>
81
+ </dd>
82
+
83
+ <dt id="user-content-globalcompletionsource">
84
+ <code>globalCompletionSource: <a href="https://codemirror.net/6/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
85
+
86
+ <dd><p>Completes snippets, keywords and the core classes.</p>
87
+ </dd>
package/dist/index.cjs CHANGED
@@ -2,33 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var lezer = require('lezer');
5
+ var lr = require('@lezer/lr');
6
6
  var language = require('@codemirror/language');
7
- var highlight = require('@codemirror/highlight');
7
+ var highlight = require('@lezer/highlight');
8
8
  var autocomplete = require('@codemirror/autocomplete');
9
9
 
10
10
  // This file was generated by lezer-generator. You probably shouldn't edit it.
11
- const spec_identifier = {__proto__:null,import:10, true:36, false:36, this:38, null:40, super:42, is:104, for:132, as:139, in:144, while:148, if:152, else:154, return:158, break:162, continue:166, foreign:172, class:174, var:194};
11
+ const spec_identifier = {__proto__:null,import:10, true:36, false:36, this:38, null:40, super:42, is:104, for:134, as:138, in:144, while:148, if:152, else:154, return:158, break:162, continue:166, foreign:172, class:174, var:194};
12
12
  const spec_word = {__proto__:null,static:183, foreign:185, construct:187};
13
- const parser = lezer.Parser.deserialize({
14
- version: 13,
15
- states: "@jO]QPOOOOQO'#Cm'#CmO#wQPO'#CtO$RQPO'#ESO!yQPO'#C{O!yQPO'#D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( ParenthesizedExpression MemberExpression . PropertyName BinaryExpression ArithOp ArithOp ArithOp RangeOp BitOp BitOp BitOp BitOp | CompareOp CompareOp is CompareOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression Equals CallExpression ArgList BlockMaybeArgs BlockArgs SequenceExpression for ImportName VariableDefinition as ForStatement ForInSpec in WhileStatement while IfStatement if else ReturnStatement return BreakStatement break ContinueStatement continue Block ClassDeclaration foreign class ClassName ClassBody MethodDeclaration static foreign construct ClassMethodName ParamList VariableDeclaration var ExpressionStatement",
13
+ const parser = lr.LRParser.deserialize({
14
+ version: 14,
15
+ states: "AYO]QPOOOOQO'#Cm'#CmO#wQPO'#CtO$RQPO'#ESO!yQPO'#C{O!yQPO'#DQO%jQPO'#EtO(pQPO'#EuOOQO'#Eu'#EuOOQO'#Et'#EtO*lOQO'#CbO+VOSO'#CbOOQO'#FP'#FPOOQO'#Eb'#EbOOQO'#Eq'#EqOOQO'#Ec'#EcQ]QPOOO+^QPO'#C`O+fQPO'#DtO+kQPO'#DwO+kQPO'#DyO+pQPO'#D|OOQO'#EO'#EOOOQO'#EQ'#EQO,mQWO'#ETO,rQPO'#ETO,wQPO'#E`O,|QPO'#EfO-WQPO'#EvO-`QPO'#EvO-jQPO,59`O-oQPO'#CxOOQO,5:n,5:nO-vQPO,5:nO/_QPO,59gO1WQPO,59lO1]Q`O,59mO!yQPO,59mOOQO'#D['#D[OOQO'#D^'#D^O!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pOOQO'#Dg'#DgO1bQPO,5:QO2`QPO'#DlO2gQPO'#DmOOQO,5:V,5:VO!yQPO'#EjO2qQPO,5:[O!yQPO,59pO!yQPO,5:TOOOO'#Ed'#EdO4qOQO,58|OOQO,58|,58|OOOO'#Ce'#CeO!yQPO'#CkOOOO'#Ee'#EeO4yOSO,58|OOQO-E8a-E8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$T$X$YQmQQrSQ!rkS!vo#wQ#OxQ#PyQ#QzQ#R{Q#S|Q#T}Q#U!OQ#V!PQ#W!QQ#X!RQ#Y!SQ#Z!UQ#]!VQ#d!YQ#f![Q#g!]Q#{&OQ$h#uQ$i#vQ$l&PQ$m&QQ$n&RQ$o&SQ$p&TQ$q&UQ$r&VQ$s&WQ$t&XQ$u&YQ$v&ZQ$w#|Q$x&[Q$y&]Q$z#}Q%s&^R&_&`RnQR!xoR#^!VQ$R#_R%m%YR!gbR%X$[",
18
+ nodeNames: "⚠ LineComment BlockComment Script ImportDeclaration import String \"\"\" \" StringEscape HexEscape UnicodeEscape CharEscape ) %( Interpolation Number VariableName BooleanLiteral this null super ] [ ArrayExpression , } { ObjectExpression Property : UnaryExpression LogicOp BitOp ArithOp ( ParenthesizedExpression MemberExpression . PropertyName BinaryExpression ArithOp ArithOp ArithOp RangeOp BitOp BitOp BitOp BitOp | CompareOp CompareOp is CompareOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression Equals CallExpression ArgList BlockMaybeArgs BlockArgs VariableDefinition SequenceExpression for ImportName as ForStatement ForInSpec in WhileStatement while IfStatement if else ReturnStatement return BreakStatement break ContinueStatement continue Block ClassDeclaration foreign class ClassName ClassBody MethodDeclaration static foreign construct ClassMethodName ParamList VariableDeclaration var ExpressionStatement",
19
19
  maxTerm: 139,
20
20
  nodeProps: [
21
- [lezer.NodeProp.group, -11,4,70,73,75,78,80,82,84,85,96,98,"Statement",-17,6,16,17,18,19,20,21,24,28,31,36,37,40,56,59,61,65,"Expression",90,"ClassItem"],
22
- [lezer.NodeProp.openedBy, 13,"%( (",22,"[",26,"{"],
23
- [lezer.NodeProp.closedBy, -2,14,35,")",23,"]",27,"}"]
21
+ ["group", -11,4,70,73,75,78,80,82,84,85,96,98,"Statement",-17,6,16,17,18,19,20,21,24,28,31,36,37,40,56,59,61,66,"Expression",90,"ClassItem"],
22
+ ["openedBy", 13,"%( (",22,"[",26,"{"],
23
+ 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c!i<o#T#Z<oS<rR!Q![<{!c!i<{#T#Z<{S=OR!Q![=X!c!i=X#T#Z=XS=[R!Q![=e!c!i=e#T#Z=eS=hR!Q![=q!c!i=q#T#Z=qS=vOZSS=yR!Q![>S!c!i>S#T#Z>SS>VR!Q![>`!c!i>`#T#Z>`S>eOYSV>nOfP#gQ#qSw>wO!Pq#gQ#qSw?QOkq#gQ#qS!X?ZP!R!R#gQ#qS#p#q?^q?cO!Xqg?lOja#gQ#qSg?wO$P`qP#gQ#qS!a@Uh#gQ#qS#l`#fq#d!ZX^%}pq%}tu(c!Q![(c!c!}(c#R#S(c#T#o(c#y#z%}$f$g%}$g#BY(c#BY#BZAp#BZ$IS(c$IS$I_Ap$I_$I|(c$I|$JOAp$JO$JT(c$JT$JUAp$JU$KV(c$KV$KWAp$KW&FU(c&FU&FVAp&FV;'S(c;'S;=`)S<%lO(c!ZAyh#l`#fq#d!ZX^%}pq%}tu(c!Q![(c!c!}(c#R#S(c#T#o(c#y#z%}$f$g%}$g#BY(c#BY#BZAp#BZ$IS(c$IS$I_Ap$I_$I|(c$I|$JOAp$JO$JT(c$JT$JUAp$JU$KV(c$KV$KWAp$KW&FU(c&FU&FVAp&FV;'S(c;'S;=`)S<%lO(c!XCjP#gQ;=`<%l'nQCrO#gQ",
28
28
  tokenizers: [0, 1, 2, 3, 4, 5],
29
29
  topRules: {"Script":[0,3]},
30
- specialized: [{term: 114, get: value => spec_identifier[value] || -1},{term: 120, get: value => spec_word[value] || -1}],
31
- tokenPrec: 3631
30
+ specialized: [{term: 114, get: (value) => spec_identifier[value] || -1},{term: 120, get: (value) => spec_word[value] || -1}],
31
+ tokenPrec: 3694
32
32
  });
33
33
 
34
34
  /// A collection of Wren-related snippets
@@ -63,11 +63,265 @@ const snippets = [
63
63
  detail: "as",
64
64
  type: "keyword"
65
65
  }),
66
+ autocomplete.snippetCompletion("if (${condition}) {\n\t${}\n}", {
67
+ label: "if",
68
+ detail: "block",
69
+ type: "keyword"
70
+ }),
71
+ autocomplete.snippetCompletion("if (${condition}) {\n\t${}\n} else {\n\t${}\n}", {
72
+ label: "if",
73
+ detail: "/ else block",
74
+ type: "keyword"
75
+ }),
76
+ autocomplete.snippetCompletion("while (${condition}) {\n\t${}\n}", {
77
+ label: "while",
78
+ detail: "loop",
79
+ type: "keyword"
80
+ }),
81
+ autocomplete.snippetCompletion("${name}(${params}) {\n\t${}\n}", {
82
+ label: "method",
83
+ detail: "definition",
84
+ type: "keyword"
85
+ }),
86
+ autocomplete.snippetCompletion("static ${name}(${params}) {\n\t${}\n}", {
87
+ label: "static",
88
+ detail: "method definition",
89
+ type: "keyword"
90
+ }),
91
+ autocomplete.snippetCompletion("construct new(${params}) {\n\t${}\n}", {
92
+ label: "construct",
93
+ detail: "constructor",
94
+ type: "keyword"
95
+ }),
66
96
  ];
67
97
 
98
+ // Wren's reserved words, and the classes and methods of its core library
99
+ // (https://wren.io/modules/core/) and the CLI's "random" module.
100
+
101
+ const keywords = ("as break class construct continue else false for foreign if " +
102
+ "import in is null return static super this true var while").split(" ");
103
+
104
+ const coreClasses = ("Bool Class Fiber Fn List Map Null Num Object Range " +
105
+ "Sequence String System").split(" ");
106
+
107
+ // Methods called on a class, as in `Num.fromString("1")`.
108
+ const staticMembers = {
109
+ Fiber: ["abort(message)", "current", "new(function)", "suspend()", "yield()", "yield(value)"],
110
+ Fn: ["new(function)"],
111
+ List: ["filled(size, element)", "new()"],
112
+ Map: ["new()"],
113
+ Num: ["fromString(value)", "infinity", "largest", "maxSafeInteger", "minSafeInteger",
114
+ "nan", "pi", "smallest", "tau"],
115
+ Object: ["same(obj1, obj2)"],
116
+ String: ["fromByte(byte)", "fromCodePoint(codePoint)"],
117
+ System: ["clock", "gc()", "print()", "print(object)", "printAll(sequence)",
118
+ "write(object)", "writeAll(sequence)"],
119
+ Random: ["new()", "new(seed)"],
120
+ };
121
+
122
+ // Methods called on a value, as in `list.count`.
123
+ const instanceMembers = {
124
+ Object: ["toString", "type"],
125
+ Class: ["name", "supertype"],
126
+ Fiber: ["call()", "call(value)", "error", "isDone", "transfer()", "transfer(value)",
127
+ "transferError(error)", "try()", "try(value)"],
128
+ Fn: ["arity", "call()"],
129
+ Sequence: ["all(predicate)", "any(predicate)", "contains(element)", "count",
130
+ "count(predicate)", "each(function)", "isEmpty", "join()", "join(separator)",
131
+ "map(transformation)", "reduce(function)", "reduce(seed, function)", "skip(count)",
132
+ "take(count)", "toList", "where(predicate)"],
133
+ List: ["add(item)", "addAll(other)", "clear()", "indexOf(value)", "insert(index, item)",
134
+ "remove(value)", "removeAt(index)", "sort()", "sort(comparer)", "swap(index0, index1)"],
135
+ Map: ["containsKey(key)", "keys", "remove(key)", "values"],
136
+ Num: ["abs", "acos", "asin", "atan", "atan(x)", "cbrt", "ceil", "clamp(min, max)", "cos",
137
+ "exp", "floor", "fraction", "isInfinity", "isInteger", "isNan", "log", "log2",
138
+ "max(other)", "min(other)", "pow(power)", "round", "sign", "sin", "sqrt", "tan",
139
+ "truncate"],
140
+ Range: ["from", "isInclusive", "max", "min", "to"],
141
+ String: ["bytes", "codePoints", "endsWith(suffix)", "indexOf(search)",
142
+ "indexOf(search, start)", "replace(old, swap)", "split(separator)",
143
+ "startsWith(prefix)", "trim()", "trim(chars)", "trimEnd()", "trimEnd(chars)",
144
+ "trimStart()", "trimStart(chars)"],
145
+ Random: ["float()", "float(end)", "float(start, end)", "int(end)", "int(start, end)",
146
+ "sample(list)", "sample(list, count)", "shuffle(list)"],
147
+ };
148
+
149
+ const ScopeNodes = new Set([
150
+ "Script", "Block", "BlockMaybeArgs", "MethodDeclaration", "ForStatement", "ClassBody"
151
+ ]);
152
+
153
+ const dontComplete = [
154
+ "String", "LineComment", "BlockComment", "VariableDefinition", "ClassMethodName"
155
+ ];
156
+
157
+ const Identifier = /^[\w$\xa1-￿]*$/;
158
+
159
+ // `foo.ba|` (the cursor is after a dot) is member completion's job.
160
+ function afterDot(context) {
161
+ return context.matchBefore(/\.\w*$/) != null
162
+ }
163
+
164
+ function text(state, node) {
165
+ return state.sliceDoc(node.from, node.to)
166
+ }
167
+
168
+ function children(node, name) {
169
+ let found = [];
170
+ for (let child = node.firstChild; child; child = child.nextSibling)
171
+ if (child.name == name) found.push(child);
172
+ return found
173
+ }
174
+
175
+ // Instance method names in a class are in scope inside its body, because
176
+ // `count` there means `this.count`.
177
+ function methodName(state, method) {
178
+ let name = children(method, "ClassMethodName")[0];
179
+ let match = name && /^[A-Za-z_]\w*/.exec(text(state, name));
180
+ return match ? match[0] : null
181
+ }
182
+
183
+ function classBodyNames(state, body, add) {
184
+ for (let method of children(body, "MethodDeclaration")) {
185
+ let name = methodName(state, method);
186
+ if (name) add(name, "method");
187
+ }
188
+ // Fields (`_name`) and static fields (`__name`) are created by assigning
189
+ // to them anywhere in the class.
190
+ body.cursor().iterate(node => {
191
+ if (node.name == "VariableName") {
192
+ let name = text(state, node);
193
+ if (name.startsWith("_")) add(name, "property");
194
+ }
195
+ });
196
+ }
197
+
198
+ function scopeNames(state, scope, add) {
199
+ if (scope.name == "ClassBody") return classBodyNames(state, scope, add)
200
+ let gather = node => {
201
+ for (let child = node.firstChild; child; child = child.nextSibling) {
202
+ if (child.name == "ImportName") {
203
+ // In `import "x" for A as B`, only `B` is in scope.
204
+ let defs = children(child, "VariableDefinition");
205
+ let name = text(state, defs[defs.length - 1]);
206
+ add(name, /^[A-Z]/.test(name) ? "class" : "variable");
207
+ } else if (child.name == "ClassDeclaration") {
208
+ let name = children(child, "ClassName")[0];
209
+ if (name) add(text(state, name), "class");
210
+ } else if (child.name == "VariableDefinition") {
211
+ add(text(state, child), "variable");
212
+ } else if (!ScopeNodes.has(child.name)) {
213
+ gather(child);
214
+ }
215
+ }
216
+ };
217
+ gather(scope);
218
+ }
219
+
220
+ /// Completes the names of variables, parameters, classes, methods and
221
+ /// fields that are in scope at the cursor.
222
+ function localCompletionSource(context) {
223
+ let inner = language.syntaxTree(context.state).resolveInner(context.pos, -1);
224
+ if (dontComplete.includes(inner.name) || afterDot(context)) return null
225
+ let word = context.matchBefore(/[\w$\xa1-￿]+$/);
226
+ if (!word && !context.explicit) return null
227
+ let seen = new Set(), options = [];
228
+ let add = (label, type) => {
229
+ if (seen.has(label)) return
230
+ seen.add(label);
231
+ options.push({label, type});
232
+ };
233
+ for (let pos = inner; pos; pos = pos.parent)
234
+ if (ScopeNodes.has(pos.name)) scopeNames(context.state, pos, add);
235
+ return {options, from: word ? word.from : context.pos, validFor: Identifier}
236
+ }
237
+
238
+ function memberOptions(signatures) {
239
+ let byName = new Map();
240
+ for (let sig of signatures) {
241
+ let paren = sig.indexOf("(");
242
+ let name = paren < 0 ? sig : sig.slice(0, paren);
243
+ let args = paren < 0 ? "" : sig.slice(paren);
244
+ if (!byName.has(name)) byName.set(name, []);
245
+ if (args) byName.get(name).push(args);
246
+ }
247
+ return [...byName].map(([label, args]) => ({
248
+ label,
249
+ type: args.length ? "method" : "property",
250
+ detail: args.join(" ") || undefined
251
+ }))
252
+ }
253
+
254
+ const staticOptions = {};
255
+ for (let name in staticMembers) staticOptions[name] = memberOptions(staticMembers[name]);
256
+
257
+ const instanceOptions = memberOptions(Object.values(instanceMembers).flat());
258
+
259
+ function fileClasses(state) {
260
+ let classes = new Map();
261
+ language.syntaxTree(state).topNode.cursor().iterate(node => {
262
+ if (node.name != "ClassDeclaration") return
263
+ let decl = node.node;
264
+ let name = children(decl, "ClassName")[0];
265
+ let body = children(decl, "ClassBody")[0];
266
+ if (!name || !body) return false
267
+ let statics = [], instance = [];
268
+ for (let method of children(body, "MethodDeclaration")) {
269
+ let label = methodName(state, method);
270
+ if (!label) continue
271
+ let onClass = children(method, "static").length || children(method, "construct").length
272
+ ;(onClass ? statics : instance).push({label, type: "method"});
273
+ }
274
+ classes.set(text(state, name), {statics, instance});
275
+ return false
276
+ });
277
+ return classes
278
+ }
279
+
280
+ /// Completes method names after a dot. After a class name, it offers that
281
+ /// class's static methods and constructors. After anything else, it offers
282
+ /// the instance methods of the core classes and of classes in the file.
283
+ function memberCompletionSource(context) {
284
+ let inner = language.syntaxTree(context.state).resolveInner(context.pos, -1);
285
+ if (dontComplete.includes(inner.name)) return null
286
+ let member = context.matchBefore(/\.\w*$/);
287
+ if (!member) return null
288
+ let line = context.state.doc.lineAt(member.from);
289
+ let before = context.state.sliceDoc(line.from, member.from);
290
+ // `0..1` is a range.
291
+ if (before.endsWith(".")) return null
292
+ let receiver = /([A-Za-z_]\w*)\s*$/.exec(before);
293
+ let name = receiver ? receiver[1] : null;
294
+ let classes = fileClasses(context.state);
295
+ let options;
296
+ if (name && classes.has(name)) options = classes.get(name).statics;
297
+ else if (name && staticOptions[name]) options = staticOptions[name];
298
+ else if (name && /^[A-Z]/.test(name)) options = [];
299
+ else {
300
+ options = [...instanceOptions];
301
+ for (let cls of classes.values()) options.push(...cls.instance);
302
+ }
303
+ let seen = new Set();
304
+ options = options.filter(o => !seen.has(o.label) && seen.add(o.label));
305
+ return {options, from: member.from + 1, validFor: Identifier}
306
+ }
307
+
308
+ const globals = snippets.concat(
309
+ keywords.map(label => ({label, type: "keyword"})),
310
+ coreClasses.map(label => ({label, type: "class"}))
311
+ );
312
+
313
+ const globalList = autocomplete.completeFromList(globals);
314
+
315
+ /// Completes snippets, keywords and the core classes.
316
+ function globalCompletionSource(context) {
317
+ let inner = language.syntaxTree(context.state).resolveInner(context.pos, -1);
318
+ if (dontComplete.includes(inner.name) || afterDot(context)) return null
319
+ return globalList(context)
320
+ }
321
+
68
322
  const lezerParser = parser;
69
323
 
70
- const wrenLanguage = language.LezerLanguage.define({
324
+ const wrenLanguage = language.LRLanguage.define({
71
325
  parser: parser.configure({
72
326
  props: [
73
327
  language.indentNodeProp.add({
@@ -134,15 +388,19 @@ const wrenLanguage = language.LezerLanguage.define({
134
388
  });
135
389
 
136
390
 
137
- /// Wren support. Includes snippets.
391
+ /// Wren support. Includes completion of snippets, keywords, core
392
+ /// classes, names in scope and methods after a dot.
138
393
  function wren(config = {}) {
139
394
  let lang = wrenLanguage;
140
- return new language.LanguageSupport(lang, wrenLanguage.data.of({
141
- autocomplete: autocomplete.ifNotIn(["LineComment", "BlockComment", "String"], autocomplete.completeFromList(snippets))
142
- }))
395
+ return new language.LanguageSupport(lang, [
396
+ globalCompletionSource, localCompletionSource, memberCompletionSource
397
+ ].map(autocomplete => wrenLanguage.data.of({autocomplete})))
143
398
  }
144
399
 
400
+ exports.globalCompletionSource = globalCompletionSource;
145
401
  exports.lezerParser = lezerParser;
402
+ exports.localCompletionSource = localCompletionSource;
403
+ exports.memberCompletionSource = memberCompletionSource;
146
404
  exports.snippets = snippets;
147
405
  exports.wren = wren;
148
406
  exports.wrenLanguage = wrenLanguage;
package/dist/index.es.js CHANGED
@@ -1,30 +1,30 @@
1
- import { Parser, NodeProp } from 'lezer';
2
- import { LezerLanguage, indentNodeProp, continuedIndent, delimitedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
3
- import { styleTags, tags } from '@codemirror/highlight';
4
- import { snippetCompletion, ifNotIn, completeFromList } from '@codemirror/autocomplete';
1
+ import { LRParser } from '@lezer/lr';
2
+ import { syntaxTree, LRLanguage, indentNodeProp, continuedIndent, delimitedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
3
+ import { styleTags, tags } from '@lezer/highlight';
4
+ import { snippetCompletion, completeFromList } from '@codemirror/autocomplete';
5
5
 
6
6
  // This file was generated by lezer-generator. You probably shouldn't edit it.
7
- const spec_identifier = {__proto__:null,import:10, true:36, false:36, this:38, null:40, super:42, is:104, for:132, as:139, in:144, while:148, if:152, else:154, return:158, break:162, continue:166, foreign:172, class:174, var:194};
7
+ const spec_identifier = {__proto__:null,import:10, true:36, false:36, this:38, null:40, super:42, is:104, for:134, as:138, in:144, while:148, if:152, else:154, return:158, break:162, continue:166, foreign:172, class:174, var:194};
8
8
  const spec_word = {__proto__:null,static:183, foreign:185, construct:187};
9
- const parser = Parser.deserialize({
10
- version: 13,
11
- states: "@jO]QPOOOOQO'#Cm'#CmO#wQPO'#CtO$RQPO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: UnaryExpression LogicOp BitOp ArithOp ( ParenthesizedExpression MemberExpression . PropertyName BinaryExpression ArithOp ArithOp ArithOp RangeOp BitOp BitOp BitOp BitOp | CompareOp CompareOp is CompareOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression Equals CallExpression ArgList BlockMaybeArgs BlockArgs SequenceExpression for ImportName VariableDefinition as ForStatement ForInSpec in WhileStatement while IfStatement if else ReturnStatement return BreakStatement break ContinueStatement continue Block ClassDeclaration foreign class ClassName ClassBody MethodDeclaration static foreign construct ClassMethodName ParamList VariableDeclaration var ExpressionStatement",
9
+ const parser = LRParser.deserialize({
10
+ version: 14,
11
+ states: "AYO]QPOOOOQO'#Cm'#CmO#wQPO'#CtO$RQPO'#ESO!yQPO'#C{O!yQPO'#DQO%jQPO'#EtO(pQPO'#EuOOQO'#Eu'#EuOOQO'#Et'#EtO*lOQO'#CbO+VOSO'#CbOOQO'#FP'#FPOOQO'#Eb'#EbOOQO'#Eq'#EqOOQO'#Ec'#EcQ]QPOOO+^QPO'#C`O+fQPO'#DtO+kQPO'#DwO+kQPO'#DyO+pQPO'#D|OOQO'#EO'#EOOOQO'#EQ'#EQO,mQWO'#ETO,rQPO'#ETO,wQPO'#E`O,|QPO'#EfO-WQPO'#EvO-`QPO'#EvO-jQPO,59`O-oQPO'#CxOOQO,5:n,5:nO-vQPO,5:nO/_QPO,59gO1WQPO,59lO1]Q`O,59mO!yQPO,59mOOQO'#D['#D[OOQO'#D^'#D^O!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pO!yQPO,59pOOQO'#Dg'#DgO1bQPO,5:QO2`QPO'#DlO2gQPO'#DmOOQO,5:V,5:VO!yQPO'#EjO2qQPO,5:[O!yQPO,59pO!yQPO,5:TOOOO'#Ed'#EdO4qOQO,58|OOQO,58|,58|OOOO'#Ce'#CeO!yQPO'#CkOOOO'#Ee'#Ee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UORT`equ!W!b!i!j!k#a#b$T$X$YQmQQrSQ!rkS!vo#wQ#OxQ#PyQ#QzQ#R{Q#S|Q#T}Q#U!OQ#V!PQ#W!QQ#X!RQ#Y!SQ#Z!UQ#]!VQ#d!YQ#f![Q#g!]Q#{&OQ$h#uQ$i#vQ$l&PQ$m&QQ$n&RQ$o&SQ$p&TQ$q&UQ$r&VQ$s&WQ$t&XQ$u&YQ$v&ZQ$w#|Q$x&[Q$y&]Q$z#}Q%s&^R&_&`RnQR!xoR#^!VQ$R#_R%m%YR!gbR%X$[",
14
+ nodeNames: "⚠ LineComment BlockComment Script ImportDeclaration import String \"\"\" \" StringEscape HexEscape UnicodeEscape CharEscape ) %( Interpolation Number VariableName BooleanLiteral this null super ] [ ArrayExpression , } { ObjectExpression Property : UnaryExpression LogicOp BitOp ArithOp ( ParenthesizedExpression MemberExpression . PropertyName BinaryExpression ArithOp ArithOp ArithOp RangeOp BitOp BitOp BitOp BitOp | CompareOp CompareOp is CompareOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression Equals CallExpression ArgList BlockMaybeArgs BlockArgs VariableDefinition SequenceExpression for ImportName as ForStatement ForInSpec in WhileStatement while IfStatement if else ReturnStatement return BreakStatement break ContinueStatement continue Block ClassDeclaration foreign class ClassName ClassBody MethodDeclaration static foreign construct ClassMethodName ParamList VariableDeclaration var ExpressionStatement",
15
15
  maxTerm: 139,
16
16
  nodeProps: [
17
- [NodeProp.group, -11,4,70,73,75,78,80,82,84,85,96,98,"Statement",-17,6,16,17,18,19,20,21,24,28,31,36,37,40,56,59,61,65,"Expression",90,"ClassItem"],
18
- [NodeProp.openedBy, 13,"%( (",22,"[",26,"{"],
19
- [NodeProp.closedBy, -2,14,35,")",23,"]",27,"}"]
17
+ ["group", -11,4,70,73,75,78,80,82,84,85,96,98,"Statement",-17,6,16,17,18,19,20,21,24,28,31,36,37,40,56,59,61,66,"Expression",90,"ClassItem"],
18
+ ["openedBy", 13,"%( (",22,"[",26,"{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R!Q![<o!c!i<o#T#Z<oS<rR!Q![<{!c!i<{#T#Z<{S=OR!Q![=X!c!i=X#T#Z=XS=[R!Q![=e!c!i=e#T#Z=eS=hR!Q![=q!c!i=q#T#Z=qS=vOZSS=yR!Q![>S!c!i>S#T#Z>SS>VR!Q![>`!c!i>`#T#Z>`S>eOYSV>nOfP#gQ#qSw>wO!Pq#gQ#qSw?QOkq#gQ#qS!X?ZP!R!R#gQ#qS#p#q?^q?cO!Xqg?lOja#gQ#qSg?wO$P`qP#gQ#qS!a@Uh#gQ#qS#l`#fq#d!ZX^%}pq%}tu(c!Q![(c!c!}(c#R#S(c#T#o(c#y#z%}$f$g%}$g#BY(c#BY#BZAp#BZ$IS(c$IS$I_Ap$I_$I|(c$I|$JOAp$JO$JT(c$JT$JUAp$JU$KV(c$KV$KWAp$KW&FU(c&FU&FVAp&FV;'S(c;'S;=`)S<%lO(c!ZAyh#l`#fq#d!ZX^%}pq%}tu(c!Q![(c!c!}(c#R#S(c#T#o(c#y#z%}$f$g%}$g#BY(c#BY#BZAp#BZ$IS(c$IS$I_Ap$I_$I|(c$I|$JOAp$JO$JT(c$JT$JUAp$JU$KV(c$KV$KWAp$KW&FU(c&FU&FVAp&FV;'S(c;'S;=`)S<%lO(c!XCjP#gQ;=`<%l'nQCrO#gQ",
24
24
  tokenizers: [0, 1, 2, 3, 4, 5],
25
25
  topRules: {"Script":[0,3]},
26
- specialized: [{term: 114, get: value => spec_identifier[value] || -1},{term: 120, get: value => spec_word[value] || -1}],
27
- tokenPrec: 3631
26
+ specialized: [{term: 114, get: (value) => spec_identifier[value] || -1},{term: 120, get: (value) => spec_word[value] || -1}],
27
+ tokenPrec: 3694
28
28
  });
29
29
 
30
30
  /// A collection of Wren-related snippets
@@ -59,11 +59,265 @@ const snippets = [
59
59
  detail: "as",
60
60
  type: "keyword"
61
61
  }),
62
+ snippetCompletion("if (${condition}) {\n\t${}\n}", {
63
+ label: "if",
64
+ detail: "block",
65
+ type: "keyword"
66
+ }),
67
+ snippetCompletion("if (${condition}) {\n\t${}\n} else {\n\t${}\n}", {
68
+ label: "if",
69
+ detail: "/ else block",
70
+ type: "keyword"
71
+ }),
72
+ snippetCompletion("while (${condition}) {\n\t${}\n}", {
73
+ label: "while",
74
+ detail: "loop",
75
+ type: "keyword"
76
+ }),
77
+ snippetCompletion("${name}(${params}) {\n\t${}\n}", {
78
+ label: "method",
79
+ detail: "definition",
80
+ type: "keyword"
81
+ }),
82
+ snippetCompletion("static ${name}(${params}) {\n\t${}\n}", {
83
+ label: "static",
84
+ detail: "method definition",
85
+ type: "keyword"
86
+ }),
87
+ snippetCompletion("construct new(${params}) {\n\t${}\n}", {
88
+ label: "construct",
89
+ detail: "constructor",
90
+ type: "keyword"
91
+ }),
62
92
  ];
63
93
 
94
+ // Wren's reserved words, and the classes and methods of its core library
95
+ // (https://wren.io/modules/core/) and the CLI's "random" module.
96
+
97
+ const keywords = ("as break class construct continue else false for foreign if " +
98
+ "import in is null return static super this true var while").split(" ");
99
+
100
+ const coreClasses = ("Bool Class Fiber Fn List Map Null Num Object Range " +
101
+ "Sequence String System").split(" ");
102
+
103
+ // Methods called on a class, as in `Num.fromString("1")`.
104
+ const staticMembers = {
105
+ Fiber: ["abort(message)", "current", "new(function)", "suspend()", "yield()", "yield(value)"],
106
+ Fn: ["new(function)"],
107
+ List: ["filled(size, element)", "new()"],
108
+ Map: ["new()"],
109
+ Num: ["fromString(value)", "infinity", "largest", "maxSafeInteger", "minSafeInteger",
110
+ "nan", "pi", "smallest", "tau"],
111
+ Object: ["same(obj1, obj2)"],
112
+ String: ["fromByte(byte)", "fromCodePoint(codePoint)"],
113
+ System: ["clock", "gc()", "print()", "print(object)", "printAll(sequence)",
114
+ "write(object)", "writeAll(sequence)"],
115
+ Random: ["new()", "new(seed)"],
116
+ };
117
+
118
+ // Methods called on a value, as in `list.count`.
119
+ const instanceMembers = {
120
+ Object: ["toString", "type"],
121
+ Class: ["name", "supertype"],
122
+ Fiber: ["call()", "call(value)", "error", "isDone", "transfer()", "transfer(value)",
123
+ "transferError(error)", "try()", "try(value)"],
124
+ Fn: ["arity", "call()"],
125
+ Sequence: ["all(predicate)", "any(predicate)", "contains(element)", "count",
126
+ "count(predicate)", "each(function)", "isEmpty", "join()", "join(separator)",
127
+ "map(transformation)", "reduce(function)", "reduce(seed, function)", "skip(count)",
128
+ "take(count)", "toList", "where(predicate)"],
129
+ List: ["add(item)", "addAll(other)", "clear()", "indexOf(value)", "insert(index, item)",
130
+ "remove(value)", "removeAt(index)", "sort()", "sort(comparer)", "swap(index0, index1)"],
131
+ Map: ["containsKey(key)", "keys", "remove(key)", "values"],
132
+ Num: ["abs", "acos", "asin", "atan", "atan(x)", "cbrt", "ceil", "clamp(min, max)", "cos",
133
+ "exp", "floor", "fraction", "isInfinity", "isInteger", "isNan", "log", "log2",
134
+ "max(other)", "min(other)", "pow(power)", "round", "sign", "sin", "sqrt", "tan",
135
+ "truncate"],
136
+ Range: ["from", "isInclusive", "max", "min", "to"],
137
+ String: ["bytes", "codePoints", "endsWith(suffix)", "indexOf(search)",
138
+ "indexOf(search, start)", "replace(old, swap)", "split(separator)",
139
+ "startsWith(prefix)", "trim()", "trim(chars)", "trimEnd()", "trimEnd(chars)",
140
+ "trimStart()", "trimStart(chars)"],
141
+ Random: ["float()", "float(end)", "float(start, end)", "int(end)", "int(start, end)",
142
+ "sample(list)", "sample(list, count)", "shuffle(list)"],
143
+ };
144
+
145
+ const ScopeNodes = new Set([
146
+ "Script", "Block", "BlockMaybeArgs", "MethodDeclaration", "ForStatement", "ClassBody"
147
+ ]);
148
+
149
+ const dontComplete = [
150
+ "String", "LineComment", "BlockComment", "VariableDefinition", "ClassMethodName"
151
+ ];
152
+
153
+ const Identifier = /^[\w$\xa1-￿]*$/;
154
+
155
+ // `foo.ba|` (the cursor is after a dot) is member completion's job.
156
+ function afterDot(context) {
157
+ return context.matchBefore(/\.\w*$/) != null
158
+ }
159
+
160
+ function text(state, node) {
161
+ return state.sliceDoc(node.from, node.to)
162
+ }
163
+
164
+ function children(node, name) {
165
+ let found = [];
166
+ for (let child = node.firstChild; child; child = child.nextSibling)
167
+ if (child.name == name) found.push(child);
168
+ return found
169
+ }
170
+
171
+ // Instance method names in a class are in scope inside its body, because
172
+ // `count` there means `this.count`.
173
+ function methodName(state, method) {
174
+ let name = children(method, "ClassMethodName")[0];
175
+ let match = name && /^[A-Za-z_]\w*/.exec(text(state, name));
176
+ return match ? match[0] : null
177
+ }
178
+
179
+ function classBodyNames(state, body, add) {
180
+ for (let method of children(body, "MethodDeclaration")) {
181
+ let name = methodName(state, method);
182
+ if (name) add(name, "method");
183
+ }
184
+ // Fields (`_name`) and static fields (`__name`) are created by assigning
185
+ // to them anywhere in the class.
186
+ body.cursor().iterate(node => {
187
+ if (node.name == "VariableName") {
188
+ let name = text(state, node);
189
+ if (name.startsWith("_")) add(name, "property");
190
+ }
191
+ });
192
+ }
193
+
194
+ function scopeNames(state, scope, add) {
195
+ if (scope.name == "ClassBody") return classBodyNames(state, scope, add)
196
+ let gather = node => {
197
+ for (let child = node.firstChild; child; child = child.nextSibling) {
198
+ if (child.name == "ImportName") {
199
+ // In `import "x" for A as B`, only `B` is in scope.
200
+ let defs = children(child, "VariableDefinition");
201
+ let name = text(state, defs[defs.length - 1]);
202
+ add(name, /^[A-Z]/.test(name) ? "class" : "variable");
203
+ } else if (child.name == "ClassDeclaration") {
204
+ let name = children(child, "ClassName")[0];
205
+ if (name) add(text(state, name), "class");
206
+ } else if (child.name == "VariableDefinition") {
207
+ add(text(state, child), "variable");
208
+ } else if (!ScopeNodes.has(child.name)) {
209
+ gather(child);
210
+ }
211
+ }
212
+ };
213
+ gather(scope);
214
+ }
215
+
216
+ /// Completes the names of variables, parameters, classes, methods and
217
+ /// fields that are in scope at the cursor.
218
+ function localCompletionSource(context) {
219
+ let inner = syntaxTree(context.state).resolveInner(context.pos, -1);
220
+ if (dontComplete.includes(inner.name) || afterDot(context)) return null
221
+ let word = context.matchBefore(/[\w$\xa1-￿]+$/);
222
+ if (!word && !context.explicit) return null
223
+ let seen = new Set(), options = [];
224
+ let add = (label, type) => {
225
+ if (seen.has(label)) return
226
+ seen.add(label);
227
+ options.push({label, type});
228
+ };
229
+ for (let pos = inner; pos; pos = pos.parent)
230
+ if (ScopeNodes.has(pos.name)) scopeNames(context.state, pos, add);
231
+ return {options, from: word ? word.from : context.pos, validFor: Identifier}
232
+ }
233
+
234
+ function memberOptions(signatures) {
235
+ let byName = new Map();
236
+ for (let sig of signatures) {
237
+ let paren = sig.indexOf("(");
238
+ let name = paren < 0 ? sig : sig.slice(0, paren);
239
+ let args = paren < 0 ? "" : sig.slice(paren);
240
+ if (!byName.has(name)) byName.set(name, []);
241
+ if (args) byName.get(name).push(args);
242
+ }
243
+ return [...byName].map(([label, args]) => ({
244
+ label,
245
+ type: args.length ? "method" : "property",
246
+ detail: args.join(" ") || undefined
247
+ }))
248
+ }
249
+
250
+ const staticOptions = {};
251
+ for (let name in staticMembers) staticOptions[name] = memberOptions(staticMembers[name]);
252
+
253
+ const instanceOptions = memberOptions(Object.values(instanceMembers).flat());
254
+
255
+ function fileClasses(state) {
256
+ let classes = new Map();
257
+ syntaxTree(state).topNode.cursor().iterate(node => {
258
+ if (node.name != "ClassDeclaration") return
259
+ let decl = node.node;
260
+ let name = children(decl, "ClassName")[0];
261
+ let body = children(decl, "ClassBody")[0];
262
+ if (!name || !body) return false
263
+ let statics = [], instance = [];
264
+ for (let method of children(body, "MethodDeclaration")) {
265
+ let label = methodName(state, method);
266
+ if (!label) continue
267
+ let onClass = children(method, "static").length || children(method, "construct").length
268
+ ;(onClass ? statics : instance).push({label, type: "method"});
269
+ }
270
+ classes.set(text(state, name), {statics, instance});
271
+ return false
272
+ });
273
+ return classes
274
+ }
275
+
276
+ /// Completes method names after a dot. After a class name, it offers that
277
+ /// class's static methods and constructors. After anything else, it offers
278
+ /// the instance methods of the core classes and of classes in the file.
279
+ function memberCompletionSource(context) {
280
+ let inner = syntaxTree(context.state).resolveInner(context.pos, -1);
281
+ if (dontComplete.includes(inner.name)) return null
282
+ let member = context.matchBefore(/\.\w*$/);
283
+ if (!member) return null
284
+ let line = context.state.doc.lineAt(member.from);
285
+ let before = context.state.sliceDoc(line.from, member.from);
286
+ // `0..1` is a range.
287
+ if (before.endsWith(".")) return null
288
+ let receiver = /([A-Za-z_]\w*)\s*$/.exec(before);
289
+ let name = receiver ? receiver[1] : null;
290
+ let classes = fileClasses(context.state);
291
+ let options;
292
+ if (name && classes.has(name)) options = classes.get(name).statics;
293
+ else if (name && staticOptions[name]) options = staticOptions[name];
294
+ else if (name && /^[A-Z]/.test(name)) options = [];
295
+ else {
296
+ options = [...instanceOptions];
297
+ for (let cls of classes.values()) options.push(...cls.instance);
298
+ }
299
+ let seen = new Set();
300
+ options = options.filter(o => !seen.has(o.label) && seen.add(o.label));
301
+ return {options, from: member.from + 1, validFor: Identifier}
302
+ }
303
+
304
+ const globals = snippets.concat(
305
+ keywords.map(label => ({label, type: "keyword"})),
306
+ coreClasses.map(label => ({label, type: "class"}))
307
+ );
308
+
309
+ const globalList = completeFromList(globals);
310
+
311
+ /// Completes snippets, keywords and the core classes.
312
+ function globalCompletionSource(context) {
313
+ let inner = syntaxTree(context.state).resolveInner(context.pos, -1);
314
+ if (dontComplete.includes(inner.name) || afterDot(context)) return null
315
+ return globalList(context)
316
+ }
317
+
64
318
  const lezerParser = parser;
65
319
 
66
- const wrenLanguage = LezerLanguage.define({
320
+ const wrenLanguage = LRLanguage.define({
67
321
  parser: parser.configure({
68
322
  props: [
69
323
  indentNodeProp.add({
@@ -130,12 +384,13 @@ const wrenLanguage = LezerLanguage.define({
130
384
  });
131
385
 
132
386
 
133
- /// Wren support. Includes snippets.
387
+ /// Wren support. Includes completion of snippets, keywords, core
388
+ /// classes, names in scope and methods after a dot.
134
389
  function wren(config = {}) {
135
390
  let lang = wrenLanguage;
136
- return new LanguageSupport(lang, wrenLanguage.data.of({
137
- autocomplete: ifNotIn(["LineComment", "BlockComment", "String"], completeFromList(snippets))
138
- }))
391
+ return new LanguageSupport(lang, [
392
+ globalCompletionSource, localCompletionSource, memberCompletionSource
393
+ ].map(autocomplete => wrenLanguage.data.of({autocomplete})))
139
394
  }
140
395
 
141
- export { lezerParser, snippets, wren, wrenLanguage };
396
+ export { globalCompletionSource, lezerParser, localCompletionSource, memberCompletionSource, snippets, wren, wrenLanguage };
package/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { Completion } from "@codemirror/autocomplete"
2
- import { LanguageSupport, LezerLanguage } from "@codemirror/language"
1
+ import { Completion, CompletionSource } from "@codemirror/autocomplete"
2
+ import { LanguageSupport, LRLanguage } from "@codemirror/language"
3
3
 
4
- export const wrenLanguage: LezerLanguage
4
+ export const wrenLanguage: LRLanguage
5
5
  export function wren(config?: {}): LanguageSupport
6
6
  export const snippets: Completion[]
7
-
7
+ export const localCompletionSource: CompletionSource
8
+ export const memberCompletionSource: CompletionSource
9
+ export const globalCompletionSource: CompletionSource
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@exercism/codemirror-lang-wren",
3
3
  "description": "Wren Lezer parser and language support for CodeMirror",
4
- "author": "Josh Goebel <me@joshgoebel.com>",
5
- "version": "0.7.2",
4
+ "author": "Josh Goebel <hello@joshgoebel.com>",
5
+ "version": "1.0.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/exercism/codemirror-lang-wren"
9
+ "url": "git+https://github.com/exercism/codemirror-lang-wren.git"
10
10
  },
11
11
  "imports": {
12
12
  "#parser": "./src/lezer/parser.js"
@@ -28,18 +28,18 @@
28
28
  "build-devtool": "npm run build-grammar && rollup -c rollup.config.devtool.js"
29
29
  },
30
30
  "dependencies": {
31
- "@codemirror/autocomplete": "^0.19.4",
32
- "@codemirror/highlight": "^0.19.6",
33
- "@codemirror/language": "^0.19.3"
31
+ "@codemirror/autocomplete": "^6.0.0",
32
+ "@codemirror/language": "^6.0.0",
33
+ "@lezer/highlight": "^1.0.0",
34
+ "@lezer/lr": "^1.0.0"
34
35
  },
35
36
  "devDependencies": {
36
- "@codemirror/basic-setup": "0.19",
37
- "@rollup/plugin-node-resolve": "^13.0.6",
37
+ "codemirror": "^6.0.0",
38
+ "@lezer/generator": "^1.1.1",
39
+ "@rollup/plugin-node-resolve": "^14.1.0",
38
40
  "colors": "^1.4.0",
39
- "lezer": "^0.13.5",
40
- "lezer-generator": "^0.13.4",
41
- "mocha": "^9.0.0",
42
- "rollup": "^2.50.4"
41
+ "rollup": "^2.50.4",
42
+ "mocha": "^10.0.0"
43
43
  },
44
44
  "files": [
45
45
  "dist",