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>
* Update indentation for PHP, JS, and TS.
Addresses https://github.com/microsoft/vscode/issues/136592
- For PHP, auto-indent after `if`, `elseif`, `else if`, `while`, `for` and `foreach`. This also fixes an issue where hitting Enter on a blank line below a single line `if` (or other) results in an extra tab.
- For PHP, extra dot after `*/` and blank line.
- For JS/TS, auto-indent for `else` to be consistent with handling of `if` statements
* polish
---------
Co-authored-by: Aiday Marlen Kyzy <amarlenkyzy@microsoft.com>
* wip
* polishing the code
* adding code
* adding the language
* reshuffling the code to avoid cyclic dependency
* polihsing code
* uncommenting tests
* also adopting the indentation rules within the reindentation operation
* using instead the sliced line tokens instead of the scoped line tokens
* polishing the code
* using start indices instead
* using value everywhere
* using the token data to type the tokens
* setting to number instead of standard token type
* using token data from autoindenttest.ts
* using same code in both test files
* placing instantiation service into the registerLanguage method
* copying object into the node js autoindent.ts
Fixes#201424
It wasn't matching closing parens, which resulted in these issues:
* Pressing enter with just a closing paren to the right of the caret
wouldn't result in a dedent on the next line
* With the caret at the start of the line below a line containing only a
closing paren, pressing tab would result in an extra level of
indentation