From 0de15edb4d2db8e7baec2560977fced772908955 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 20 Oct 2023 15:46:09 +0200 Subject: [PATCH] [JavaScript] Fix block comment punctuation This commit adds scoping for leading asterisks in (normal) block comments so ST's word_wrap command can add them to each wrapped line, if present in the first one. Notes: This change aligns JavaScript with Java and C/C++. Related with #3855 --- JavaScript/JavaScript.sublime-syntax | 3 +++ JavaScript/tests/syntax_test_js.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index 7661d8222b..4e1874e85d 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -151,6 +151,9 @@ contexts: - meta_include_prototype: false - meta_scope: comment.block.js - include: block-comment-end + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.js jsdoc-comment-body: - meta_include_prototype: false diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index 1fb1524e9f..f0c27e7280 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -28,6 +28,12 @@ //^^^ comment.block.js // ^ - comment + /* + * comment +// ^ comment.block.js punctuation.definition.comment.js +// ^^^^^^^^^ comment.block.js - punctuation + */ + /**/ /***/ // ^ - comment // ^^^^ comment.block.empty.js punctuation.definition.comment.js