Skip to content

Commit 8519477

Browse files
fix(textmate): grammer
1 parent 5d7ecde commit 8519477

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

packages/textmate/scripts/grammar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ export function createMiraScriptDocGrammar(): LanguageRegistration {
927927
beginCaptures: {
928928
1: { name: 'keyword.operator.spread.mira' },
929929
3: { name: 'keyword.declaration.mutable.mira' },
930-
5: { name: 'variable.other.constant.emphasis.mira' },
930+
5: { name: 'variable.emphasis.mira' },
931931
7: { name: 'punctuation.separator.type.mira' },
932932
},
933933
end: String.raw`(?=,|\))`,
@@ -942,7 +942,7 @@ export function createMiraScriptDocGrammar(): LanguageRegistration {
942942
},
943943
},
944944
{ name: 'keyword.operator.spread.mira', match: String.raw`\.\.` },
945-
{ name: 'variable.other.constant.emphasis.mira', match: IDENTIFIER },
945+
{ name: 'variable.emphasis.mira', match: IDENTIFIER },
946946
{ name: 'punctuation.separator.parameter.mira', match: ',' },
947947
],
948948
},

packages/textmate/test/grammar.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ test('highlights generated documentation syntax', () => {
272272
const tokens = tokenize(
273273
[
274274
'\0(parameter) mut value',
275+
'\0(parameter) plain',
275276
'(field) description',
276277
'let immutable',
277278
'const @constant',
@@ -286,6 +287,7 @@ test('highlights generated documentation syntax', () => {
286287
expectScope(tokens, '(parameter)', 'entity.name.label.mira');
287288
expectScope(tokens, '(field)', 'entity.name.label.mira');
288289
expectScope(tokens, 'value', 'variable.emphasis.mira');
290+
expectScope(tokens, 'plain', 'variable.other.constant.emphasis.mira');
289291
expectScope(tokens, 'immutable', 'variable.other.constant.mira');
290292
expectScope(tokens, '@constant', 'variable.other.constant.mira');
291293
expectScope(tokens, 'mutable', 'variable.other.readwrite.mira');
@@ -296,9 +298,11 @@ test('highlights generated documentation syntax', () => {
296298
expectScope(tokens, 'callback', 'entity.name.function.emphasis.mira');
297299
expectScope(tokens, 'boolean', 'support.type.builtin.mira');
298300
expectScope(tokens, 'MyValue', 'variable.other.mira');
299-
expectScope(tokens, 'field', 'variable.other.constant.emphasis.mira');
301+
expectScope(tokens, 'field', 'variable.emphasis.mira');
302+
expectScope(tokens, 'nested', 'variable.emphasis.mira');
303+
expectScope(tokens, 'name', 'variable.other.property.mira');
300304
assert.ok(
301-
!tokens.filter((token) => token.line === 8).some((token) => token.scopes.includes('entity.name.label.mira')),
305+
!tokens.filter((token) => token.line === 9).some((token) => token.scopes.includes('entity.name.label.mira')),
302306
);
303307
expectScope(tokens, '->', 'keyword.operator.type.mira');
304308
});
@@ -327,9 +331,9 @@ test('distinguishes doc declarations, globals, and nested function types', () =>
327331
expectScope(tokens, '(global)', 'entity.name.label.mira', 0);
328332
expectScope(tokens, 'fn', 'keyword.declaration.function.mira', 0);
329333
expectScope(tokens, 'fn', 'support.type.function.mira', 2);
330-
expectScope(tokens, 'data', 'variable.other.constant.emphasis.mira', 1);
334+
expectScope(tokens, 'data', 'variable.emphasis.mira', 1);
331335
expectScope(tokens, 'f', 'entity.name.function.emphasis.mira');
332-
expectScope(tokens, 'value', 'variable.other.constant.emphasis.mira');
336+
expectScope(tokens, 'value', 'variable.emphasis.mira');
333337
expectScope(tokens, 'type', 'keyword.operator.expression.mira');
334338
expectScope(tokens, 'data', 'variable.other.mira', 2);
335339
});
@@ -381,8 +385,8 @@ test('keeps tuple and array element types inside their type context', () => {
381385
].join('\n'),
382386
'mirascript-doc',
383387
);
384-
expectScope(tokens, 'matrix', 'variable.other.constant.emphasis.mira');
385-
expectScope(tokens, 'size', 'variable.other.constant.emphasis.mira', 1);
388+
expectScope(tokens, 'matrix', 'variable.emphasis.mira');
389+
expectScope(tokens, 'size', 'variable.emphasis.mira', 1);
386390
for (const token of tokens.filter((candidate) => candidate.text === 'number')) {
387391
assert.ok(
388392
token.scopes.includes('support.type.builtin.mira'),

0 commit comments

Comments
 (0)