fix(javascript): sync JSDoc continuation patterns with TypeScript language config (#308433)

fix(javascript): sync JSDoc continuation patterns with TypeScript config

Both language configuration files carry a comment stating they should
stay in sync with each other, but two JSDoc-related regex patterns had
drifted in the JavaScript file.

1. `unIndentedLinePattern` — the third alternative that matches an
   in-progress JSDoc continuation line (`* comment text`) required a
   literal space immediately before the `*`:
     Before: `^(\\t|[ ])*[ ]\\*([ ]...`
     After:  `^(\\t|[ ])*\\*([ ]...`

2. `onEnterRules` — the `beforeText` pattern for the rule that appends
   `* ` when pressing Enter inside a JSDoc block had the same extra
   space requirement.

The TypeScript configuration does not require this leading space, which
means that JSDoc comments whose `*` continuation lines are indented with
tabs only (e.g. `\t* line`) were recognized correctly in TypeScript
files but not in JavaScript files. After this change both files use the
same permissive pattern.

Also aligns the `wordPattern` character-class order (`@~` → `@~`,
purely cosmetic, no behavioral difference).

Co-authored-by: yogeshwaran-c <yogeshwaran.c@example.com>
Co-authored-by: Dmitriy Vasyura <dmitriv@microsoft.com>
This commit is contained in:
Yogeshwaran C
2026-07-27 23:02:25 +00:00
committed by GitHub
co-authored by yogeshwaran-c Dmitriy Vasyura
parent f9a9ac4ab9
commit 58a6f63814
@@ -119,7 +119,7 @@
}
},
"wordPattern": {
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\@\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\@\\~\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
},
"indentationRules": {
"decreaseIndentPattern": {
@@ -130,7 +130,7 @@
},
// e.g. * ...| or */| or *-----*/|
"unIndentedLinePattern": {
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*\\*([ ]([^\\*]|\\*(?!/))*)?$"
},
"indentNextLinePattern": {
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)((if|while|for)\\s*\\(.*\\)\\s*|else\\s*)))$"
@@ -163,7 +163,7 @@
{
// e.g. * ...|
"beforeText": {
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
"pattern": "^(\\t|[ ])*\\*([ ]([^\\*]|\\*(?!/))*)?$"
},
"previousLineText": {
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"