Skip to content

Commit 75c9879

Browse files
Fix OCaml syntax highlighting for let followed by attribute. Fixes rescript-lang#409. (rescript-lang#412)
1 parent efe3824 commit 75c9879

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

editor-extensions/vscode/ocaml.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

editor-extensions/vscode/src/syntaxes/ocaml.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,15 @@ export class OCaml implements basis.ILanguage {
560560
4: { name: Scope.PUNCTUATION_EQUALS() },
561561
},
562562
patterns: [
563+
{
564+
begin: lastWords(Token.REC),
565+
end: alt(capture(this.identLower()), lookAhead(complement(Class.space, Class.alpha))),
566+
endCaptures: {
567+
0: { name: Scope.NAME_FUNCTION() },
568+
},
569+
patterns: [include(this.bindTermArgs)],
570+
},
571+
include(this.bindTermArgs),
563572
{
564573
begin: alt(this.lastOps("!"), lastWords(Token.AND, Token.EXTERNAL, Token.LET, Token.METHOD, Token.VAL)),
565574
end: alt(
@@ -579,15 +588,6 @@ export class OCaml implements basis.ILanguage {
579588
},
580589
patterns: [include(this.attributeIdentifier), include(this.comment)],
581590
},
582-
{
583-
begin: lastWords(Token.REC),
584-
end: alt(capture(this.identLower()), lookAhead(complement(Class.space, Class.alpha))),
585-
endCaptures: {
586-
0: { name: Scope.NAME_FUNCTION() },
587-
},
588-
patterns: [include(this.bindTermArgs)],
589-
},
590-
include(this.bindTermArgs),
591591
],
592592
},
593593
{
@@ -960,7 +960,7 @@ export class OCaml implements basis.ILanguage {
960960
endCaptures: {
961961
0: { name: Scope.STYLE_DELIMITER() },
962962
},
963-
patterns: [include(this.comment), include(this.pragma), include(this.bindTerm)],
963+
patterns: [include(this.pragma), include(this.bindTerm), include(this.comment)],
964964
};
965965
}
966966

0 commit comments

Comments
 (0)