Tags: patch
* Bug: `js-ts-mode` is missing indentation rules for bracketless
statements.
These missing rules are the same as those that were previously missing
from typescript-ts-mode (bug#67031).
Recipe to reproduce:
Using the following function to configure js-ts-mode and indent the
buffer:
(defun try-indent ()
(interactive)
(setq-local indent-tabs-mode nil)
(setq-local js-indent-level 2)
(js-ts-mode)
(indent-region (point-min) (point-max)))
Add the following example to a buffer and call `try-indent`.
function bracketless_statements(x) {
if (x == 0)
console.log("if_statement");
else if (x == 1)
console.log("if_statement");
else
console.log("else_clause");
for (let i = 0; i < 1; i++)
console.log("for_statement");
for (let _ of [true])
console.log("for_in_statement");
while (x-- > 0)
console.log("while_statement");
do
console.log("do_statement");
while (false)
};
Afterwards, you should see none of the statement bodies were indented.