From ed53e5a7736fcc9d0bf8f911284a59acf99d705c Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Sun, 23 Aug 2020 02:15:22 -0700 Subject: [PATCH] Assign scope to comment punctuations --- ReScript.sublime-syntax | 11 ++++++++--- syntax_test.res | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ReScript.sublime-syntax b/ReScript.sublime-syntax index f9cd372..58364f7 100644 --- a/ReScript.sublime-syntax +++ b/ReScript.sublime-syntax @@ -19,15 +19,20 @@ variables: contexts: commentLine: - - match: //.* - # TODO: append with file scope - scope: comment.line + - match: // + scope: punctuation.definition.comment + push: + - meta_scope: comment.line + - match: \n + pop: true commentBlock: - match: /\* + scope: punctuation.definition.comment.begin push: - meta_scope: comment.block - match: \*/ + scope: punctuation.definition.comment.end pop: true punctuations: diff --git a/syntax_test.res b/syntax_test.res index 8e7d4e6..9c82d59 100644 --- a/syntax_test.res +++ b/syntax_test.res @@ -4,12 +4,13 @@ // ^ source.res comment.line // -// <- source.res comment.line +// <- source.res comment.line punctuation.definition.comment /* hello -// <- source.res comment.block +// <- source.res comment.block punctuation.definition.comment.begin world */ -// ^ source.res comment.block +//^ source.res comment.block +// ^ source.res comment.block punctuation.definition.comment.end "aa"; // ^ source.res string.quoted.double punctuation.definition.string.begin