Ciao, a rule like this: ((node-is "statement_block") parent-bol 0) works for function but brakes the indentation of expressione like this: const Geek = (a, b) => { return (a + " " + b); } In the attached patch, I have added a new rule specifically for this case. Vincenzo In data sabato 22 marzo 2025 13:24:16 Ora standard dell’Europa centrale, Eli Zaretskii ha scritto: > Ping! Juri and Vincenzo, please chime in. > > > Cc: 76704@debbugs.gnu.org > > Date: Sun, 09 Mar 2025 12:00:16 +0200 > > From: Eli Zaretskii > > > > > Date: Sun, 02 Mar 2025 20:44:39 +0100 > > > From: Fabian Brosda via "Bug reports for GNU Emacs, > > > > > > the Swiss army knife of text editors" > > > > > > Hi, > > > > > > when using js-ts-mode instead of js-mode, braces, which are put on a > > > separate line are indented one level too much. Here is a simple example > > > of how the indentation looks like, after using indent-region on the > > > whole function: > > > > > > ``` > > > function test(x) > > > > > > { > > > > > > if(x) > > > > > > { > > > > > > return a; > > > > > > } > > > > > > else > > > > > > { > > > > > > return b; > > > > > > } > > > > > > } > > > > > > ``` > > > > > > The used tree-sitter grammar is downloaded from > > > https://github.com/tree-sitter/tree-sitter-javascript. > > > > > > Having braces on a separate line is probably not the most common for > > > javascript, but using indent-region in the js-mode, does yield the > > > expected result. The js.el file does already contain a comment > > > mentioning braces in js--treesit-indent-rules. But even based on the > > > git history it is not clear to me, what exactly is meant: > > > > > > ``` > > > > > > ;; "{" on the newline. > > > ((node-is "statement_block") parent-bol js-indent-level) > > > > > > ``` > > > > > > Link: > > > https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/js.el# > > > L3457 > > > > > > If I replace 'js-indent-level' with '0' in this line, the indentation > > > would > > > be correct, but this might have unwanted side-effects I overlooked. > > > > > > My current emacs version: > > > > > > GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.48, > > > cairo version 1.18.2) > > > > > > Thanks for looking into this. > > > > Juri and Vincenzo, any comments?