Package: emacs;
Reported by: Fabian Brosda <f.brosda <at> gmx.de>
Date: Mon, 3 Mar 2025 04:33:03 UTC
Severity: minor
Found in version 30.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76704 in the body.
You can then email your comments to 76704 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Mon, 03 Mar 2025 04:33:03 GMT) Full text and rfc822 format available.Fabian Brosda <f.brosda <at> gmx.de>
:bug-gnu-emacs <at> gnu.org
.
(Mon, 03 Mar 2025 04:33:04 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: bug-gnu-emacs <at> gnu.org Subject: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 02 Mar 2025 20:44:39 +0100
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. Fabian
Stefan Kangas <stefankangas <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Tue, 04 Mar 2025 01:25:04 GMT) Full text and rfc822 format available.bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sun, 09 Mar 2025 10:01:02 GMT) Full text and rfc822 format available.Message #10 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Fabian Brosda <f.brosda <at> gmx.de>, Juri Linkov <juri <at> linkov.net>, Vincenzo Pupillo <v.pupillo <at> gmail.com> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 09 Mar 2025 12:00:16 +0200
> 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" <bug-gnu-emacs <at> gnu.org> > > 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?
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sat, 22 Mar 2025 12:25:02 GMT) Full text and rfc822 format available.Message #13 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: juri <at> linkov.net, v.pupillo <at> gmail.com Cc: f.brosda <at> gmx.de, 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sat, 22 Mar 2025 14:24:16 +0200
Ping! Juri and Vincenzo, please chime in. > Cc: 76704 <at> debbugs.gnu.org > Date: Sun, 09 Mar 2025 12:00:16 +0200 > From: Eli Zaretskii <eliz <at> gnu.org> > > > 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" <bug-gnu-emacs <at> gnu.org> > > > > 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? > > > >
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sat, 22 Mar 2025 22:50:02 GMT) Full text and rfc822 format available.Message #16 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: f.brosda <at> gmx.de, 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sat, 22 Mar 2025 23:48:57 +0100
[Message part 1 (text/plain, inline)]
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 <at> debbugs.gnu.org > > Date: Sun, 09 Mar 2025 12:00:16 +0200 > > From: Eli Zaretskii <eliz <at> gnu.org> > > > > > 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" <bug-gnu-emacs <at> gnu.org> > > > > > > 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?
[0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sun, 23 Mar 2025 10:19:01 GMT) Full text and rfc822 format available.Message #19 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 23 Mar 2025 11:18:02 +0100
Hi, thanks for the explanation and the patch. The result from the patch is a GNU-style indentation, where only the braces for functions are not indented, while braces for other blocks (if/else, loops, arrow functions) are indented. What I would like to have is Allman style indentation, where the braces for blocks like if/else indent the same as for functions. This also seems the default behavior in the old js-mode. In this case I think it would be correct to not indent the brace for the arrow function. For reference, I found an issue in eslint regarding this indentation: https://github.com/eslint/eslint/issues/8493 Would it be possible to also support the later? Fabian Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > 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 <at> debbugs.gnu.org >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 >> > From: Eli Zaretskii <eliz <at> gnu.org> >> > >> > > 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" <bug-gnu-emacs <at> gnu.org> >> > > >> > > 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? > > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 2001 > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > Date: Sat, 22 Mar 2025 23:43:52 +0100 > Subject: [PATCH] Fix indentation of "{" when on a new line of a function > declaration. > > * lisp/progmodes/js.el > (js--treesit-indent-rules): New rule for the indentation of "{" when > of a new line of a function declaration. (bug#76704) > --- > lisp/progmodes/js.el | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > index 3e789218fde..6943ffc2d28 100644 > --- a/lisp/progmodes/js.el > +++ b/lisp/progmodes/js.el > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules > ((parent-is "ternary_expression") parent-bol js-indent-level) > ((parent-is "member_expression") parent-bol js-indent-level) > ((node-is ,switch-case) parent-bol 0) > - ;; "{" on the newline. > + ;; "{" on the newline for functions. > + ((query "(function_declaration body: (statement_block \"{\") @indent)") > + parent-bol 0) > + ;; "{" on the newline in other cases. > ((node-is "statement_block") parent-bol js-indent-level) > ((parent-is "named_imports") parent-bol js-indent-level) > ((parent-is "statement_block") parent-bol js-indent-level) > -- > 2.49.0
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sun, 23 Mar 2025 18:22:02 GMT) Full text and rfc822 format available.Message #22 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 23 Mar 2025 19:21:04 +0100
Ciao Fabian, thank you. In fact, there are other cases where it does not work, and especially the behavior is different from js-mode. I need to think about this a bit more.. Vincenzo In data domenica 23 marzo 2025 11:18:02 Ora standard dell’Europa centrale, Fabian Brosda ha scritto: > Hi, > thanks for the explanation and the patch. The result from the patch is > a GNU-style indentation, where only the braces for functions are not > indented, while braces for other blocks (if/else, loops, arrow > functions) are indented. > > What I would like to have is Allman style indentation, where the braces > for blocks like if/else indent the same as for functions. This also > seems the default behavior in the old js-mode. In this case I think it > would be correct to not indent the brace for the arrow function. For > reference, I found an issue in eslint regarding this indentation: > > https://github.com/eslint/eslint/issues/8493 > > Would it be possible to also support the later? > > Fabian > > Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > > 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 <at> debbugs.gnu.org > >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 > >> > From: Eli Zaretskii <eliz <at> gnu.org> > >> > > >> > > 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" <bug-gnu-emacs <at> gnu.org> > >> > > > >> > > 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.e > >> > > l# > >> > > 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? > > > > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 2001 > > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > > Date: Sat, 22 Mar 2025 23:43:52 +0100 > > Subject: [PATCH] Fix indentation of "{" when on a new line of a function > > > > declaration. > > > > * lisp/progmodes/js.el > > (js--treesit-indent-rules): New rule for the indentation of "{" when > > of a new line of a function declaration. (bug#76704) > > --- > > > > lisp/progmodes/js.el | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > > index 3e789218fde..6943ffc2d28 100644 > > --- a/lisp/progmodes/js.el > > +++ b/lisp/progmodes/js.el > > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules > > > > ((parent-is "ternary_expression") parent-bol js-indent-level) > > ((parent-is "member_expression") parent-bol js-indent-level) > > ((node-is ,switch-case) parent-bol 0) > > > > - ;; "{" on the newline. > > + ;; "{" on the newline for functions. > > + ((query "(function_declaration body: (statement_block \"{\") > > @indent)") + parent-bol 0) > > + ;; "{" on the newline in other cases. > > > > ((node-is "statement_block") parent-bol js-indent-level) > > ((parent-is "named_imports") parent-bol js-indent-level) > > ((parent-is "statement_block") parent-bol js-indent-level)
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sun, 23 Mar 2025 19:22:02 GMT) Full text and rfc822 format available.Message #25 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 23 Mar 2025 20:20:56 +0100
Hi Vincenzo, all right, thanks for taking care of it. Just in case you don't already know and maybe interesting, if the indentation should in fact be exactly the same as in js-mode, I noticed, that your arrow function example is indented differently. In js-mode: const Geek = (a, b) => { return (a + " " + b); } In js-ts-mode: const Geek = (a, b) => { return (a + " " + b); } js-indent-level is set to 4 in both cases. Looks like js-mode in general aligns the part of a variable declaration, with the start of the variable if you add a line break somewhere. Fabian Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > Ciao Fabian, thank you. > In fact, there are other cases where it does not work, and especially the > behavior is different from js-mode. I need to think about this a bit more.. > > Vincenzo > > In data domenica 23 marzo 2025 11:18:02 Ora standard dell’Europa centrale, > Fabian Brosda ha scritto: >> Hi, >> thanks for the explanation and the patch. The result from the patch is >> a GNU-style indentation, where only the braces for functions are not >> indented, while braces for other blocks (if/else, loops, arrow >> functions) are indented. >> >> What I would like to have is Allman style indentation, where the braces >> for blocks like if/else indent the same as for functions. This also >> seems the default behavior in the old js-mode. In this case I think it >> would be correct to not indent the brace for the arrow function. For >> reference, I found an issue in eslint regarding this indentation: >> >> https://github.com/eslint/eslint/issues/8493 >> >> Would it be possible to also support the later? >> >> Fabian >> >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: >> > 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 <at> debbugs.gnu.org >> >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 >> >> > From: Eli Zaretskii <eliz <at> gnu.org> >> >> > >> >> > > 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" <bug-gnu-emacs <at> gnu.org> >> >> > > >> >> > > 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.e >> >> > > l# >> >> > > 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? >> > >> > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 2001 >> > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> >> > Date: Sat, 22 Mar 2025 23:43:52 +0100 >> > Subject: [PATCH] Fix indentation of "{" when on a new line of a function >> > >> > declaration. >> > >> > * lisp/progmodes/js.el >> > (js--treesit-indent-rules): New rule for the indentation of "{" when >> > of a new line of a function declaration. (bug#76704) >> > --- >> > >> > lisp/progmodes/js.el | 5 ++++- >> > 1 file changed, 4 insertions(+), 1 deletion(-) >> > >> > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el >> > index 3e789218fde..6943ffc2d28 100644 >> > --- a/lisp/progmodes/js.el >> > +++ b/lisp/progmodes/js.el >> > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules >> > >> > ((parent-is "ternary_expression") parent-bol js-indent-level) >> > ((parent-is "member_expression") parent-bol js-indent-level) >> > ((node-is ,switch-case) parent-bol 0) >> > >> > - ;; "{" on the newline. >> > + ;; "{" on the newline for functions. >> > + ((query "(function_declaration body: (statement_block \"{\") >> > @indent)") + parent-bol 0) >> > + ;; "{" on the newline in other cases. >> > >> > ((node-is "statement_block") parent-bol js-indent-level) >> > ((parent-is "named_imports") parent-bol js-indent-level) >> > ((parent-is "statement_block") parent-bol js-indent-level)
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Wed, 26 Mar 2025 14:59:03 GMT) Full text and rfc822 format available.Message #28 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Wed, 26 Mar 2025 15:58:09 +0100
[Message part 1 (text/plain, inline)]
Thank you Fabian. This new patch also fixes this problem in my tests. Can you please try it in your use cases? There would be some other things to fix as well, but maybe it would be better to do it in emacs 31. What do you think Eli? Vincenzo In data domenica 23 marzo 2025 20:20:56 Ora standard dell’Europa centrale, Fabian Brosda ha scritto: > Hi Vincenzo, > > all right, thanks for taking care of it. Just in case you don't already > know and maybe interesting, if the indentation should in fact be exactly > the same as in js-mode, I noticed, that your arrow function example is > indented differently. > > In js-mode: > > const Geek = (a, b) => > { > return (a + " " + b); > } > > > In js-ts-mode: > > const Geek = (a, b) => > { > return (a + " " + b); > } > > js-indent-level is set to 4 in both cases. Looks like js-mode in general > aligns the part of a variable declaration, with the start of the > variable if you add a line break somewhere. > > Fabian > > Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > > Ciao Fabian, thank you. > > In fact, there are other cases where it does not work, and especially the > > behavior is different from js-mode. I need to think about this a bit > > more.. > > > > Vincenzo > > > > In data domenica 23 marzo 2025 11:18:02 Ora standard dell’Europa centrale, > > > > Fabian Brosda ha scritto: > >> Hi, > >> thanks for the explanation and the patch. The result from the patch is > >> a GNU-style indentation, where only the braces for functions are not > >> indented, while braces for other blocks (if/else, loops, arrow > >> functions) are indented. > >> > >> What I would like to have is Allman style indentation, where the braces > >> for blocks like if/else indent the same as for functions. This also > >> seems the default behavior in the old js-mode. In this case I think it > >> would be correct to not indent the brace for the arrow function. For > >> reference, I found an issue in eslint regarding this indentation: > >> > >> https://github.com/eslint/eslint/issues/8493 > >> > >> Would it be possible to also support the later? > >> > >> Fabian > >> > >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > >> > 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 <at> debbugs.gnu.org > >> >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 > >> >> > From: Eli Zaretskii <eliz <at> gnu.org> > >> >> > > >> >> > > 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" <bug-gnu-emacs <at> gnu.org> > >> >> > > > >> >> > > 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/j > >> >> > > s.e > >> >> > > l# > >> >> > > 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? > >> > > >> > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 2001 > >> > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > >> > Date: Sat, 22 Mar 2025 23:43:52 +0100 > >> > Subject: [PATCH] Fix indentation of "{" when on a new line of a > >> > function > >> > > >> > declaration. > >> > > >> > * lisp/progmodes/js.el > >> > (js--treesit-indent-rules): New rule for the indentation of "{" when > >> > of a new line of a function declaration. (bug#76704) > >> > --- > >> > > >> > lisp/progmodes/js.el | 5 ++++- > >> > 1 file changed, 4 insertions(+), 1 deletion(-) > >> > > >> > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > >> > index 3e789218fde..6943ffc2d28 100644 > >> > --- a/lisp/progmodes/js.el > >> > +++ b/lisp/progmodes/js.el > >> > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules > >> > > >> > ((parent-is "ternary_expression") parent-bol js-indent-level) > >> > ((parent-is "member_expression") parent-bol js-indent-level) > >> > ((node-is ,switch-case) parent-bol 0) > >> > > >> > - ;; "{" on the newline. > >> > + ;; "{" on the newline for functions. > >> > + ((query "(function_declaration body: (statement_block \"{\") > >> > @indent)") + parent-bol 0) > >> > + ;; "{" on the newline in other cases. > >> > > >> > ((node-is "statement_block") parent-bol js-indent-level) > >> > ((parent-is "named_imports") parent-bol js-indent-level) > >> > ((parent-is "statement_block") parent-bol js-indent-level)
[0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Thu, 27 Mar 2025 19:00:02 GMT) Full text and rfc822 format available.Message #31 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Thu, 27 Mar 2025 19:59:33 +0100
Hi Vincenzo, great that there is already an updated patch. I did test it and it looks good for functions, conditionals, loops. Regarding arrow functions (or variable declarations in general), the result is different, then with js-mode, but personally I think the result looks more consistent in js-ts-mode. There is one exception though. switch-case statements with the brace on a separate line inside a function break js-ts-mode. But it is not really a regression, it looks even worse without the patch :D I tried to add an attachment, with a few examples, but the mail delivery was rejected. Therefore putting only the switch-case example inline into the mail: js-mode: function switch_test(a) { switch (a) { case 1: x; break; case 2: y; break; default: z; break; } switch (a) { case 1: x; break; case 2: y; break; default: z; break; } } js-ts-mode: function switch_test(a) { switch (a) { case 1: x; break; case 2: y; break; default: z; break; } switch (a) { case 1: x; break; case 2: y; break; default: z; break; } } Hope this works now. If you want more examples, I could put them in a github gist, but the rest is not always exactly the same in both modes, but imo fine either way. Fabian Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > Thank you Fabian. > This new patch also fixes this problem in my tests. Can you please try it in > your use cases? > There would be some other things to fix as well, but maybe it would be better > to do it in emacs 31. What do you think Eli? > > Vincenzo > > In data domenica 23 marzo 2025 20:20:56 Ora standard dell’Europa centrale, > Fabian Brosda ha scritto: >> Hi Vincenzo, >> >> all right, thanks for taking care of it. Just in case you don't already >> know and maybe interesting, if the indentation should in fact be exactly >> the same as in js-mode, I noticed, that your arrow function example is >> indented differently. >> >> In js-mode: >> >> const Geek = (a, b) => >> { >> return (a + " " + b); >> } >> >> >> In js-ts-mode: >> >> const Geek = (a, b) => >> { >> return (a + " " + b); >> } >> >> js-indent-level is set to 4 in both cases. Looks like js-mode in general >> aligns the part of a variable declaration, with the start of the >> variable if you add a line break somewhere. >> >> Fabian >> >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: >> > Ciao Fabian, thank you. >> > In fact, there are other cases where it does not work, and especially the >> > behavior is different from js-mode. I need to think about this a bit >> > more.. >> > >> > Vincenzo >> > >> > In data domenica 23 marzo 2025 11:18:02 Ora standard dell’Europa centrale, >> > >> > Fabian Brosda ha scritto: >> >> Hi, >> >> thanks for the explanation and the patch. The result from the patch is >> >> a GNU-style indentation, where only the braces for functions are not >> >> indented, while braces for other blocks (if/else, loops, arrow >> >> functions) are indented. >> >> >> >> What I would like to have is Allman style indentation, where the braces >> >> for blocks like if/else indent the same as for functions. This also >> >> seems the default behavior in the old js-mode. In this case I think it >> >> would be correct to not indent the brace for the arrow function. For >> >> reference, I found an issue in eslint regarding this indentation: >> >> >> >> https://github.com/eslint/eslint/issues/8493 >> >> >> >> Would it be possible to also support the later? >> >> >> >> Fabian >> >> >> >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: >> >> > 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 <at> debbugs.gnu.org >> >> >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 >> >> >> > From: Eli Zaretskii <eliz <at> gnu.org> >> >> >> > >> >> >> > > 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" <bug-gnu-emacs <at> gnu.org> >> >> >> > > >> >> >> > > 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/j >> >> >> > > s.e >> >> >> > > l# >> >> >> > > 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? >> >> > >> >> > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 2001 >> >> > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> >> >> > Date: Sat, 22 Mar 2025 23:43:52 +0100 >> >> > Subject: [PATCH] Fix indentation of "{" when on a new line of a >> >> > function >> >> > >> >> > declaration. >> >> > >> >> > * lisp/progmodes/js.el >> >> > (js--treesit-indent-rules): New rule for the indentation of "{" when >> >> > of a new line of a function declaration. (bug#76704) >> >> > --- >> >> > >> >> > lisp/progmodes/js.el | 5 ++++- >> >> > 1 file changed, 4 insertions(+), 1 deletion(-) >> >> > >> >> > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el >> >> > index 3e789218fde..6943ffc2d28 100644 >> >> > --- a/lisp/progmodes/js.el >> >> > +++ b/lisp/progmodes/js.el >> >> > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules >> >> > >> >> > ((parent-is "ternary_expression") parent-bol js-indent-level) >> >> > ((parent-is "member_expression") parent-bol js-indent-level) >> >> > ((node-is ,switch-case) parent-bol 0) >> >> > >> >> > - ;; "{" on the newline. >> >> > + ;; "{" on the newline for functions. >> >> > + ((query "(function_declaration body: (statement_block \"{\") >> >> > @indent)") + parent-bol 0) >> >> > + ;; "{" on the newline in other cases. >> >> > >> >> > ((node-is "statement_block") parent-bol js-indent-level) >> >> > ((parent-is "named_imports") parent-bol js-indent-level) >> >> > ((parent-is "statement_block") parent-bol js-indent-level) > > From 2d715869962c3720c80ec3009adade5dd3c4c8b1 Mon Sep 17 00:00:00 2001 > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > Date: Sat, 22 Mar 2025 23:43:52 +0100 > Subject: [PATCH] Fix indentation of "{" when on a new line of a function > declaration. > > * lisp/progmodes/js.el > (js--treesit-indent-rules): Fix rule for the indentation of "{" when > of a new line of a function declaration. (bug#76704) > Fix other related rules. > --- > lisp/progmodes/js.el | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > index 3e789218fde..802d74103df 100644 > --- a/lisp/progmodes/js.el > +++ b/lisp/progmodes/js.el > @@ -3454,7 +3454,7 @@ js--treesit-indent-rules > (let ((switch-case (rx "switch_" (or "case" "default")))) > `((javascript > ((parent-is "program") parent-bol 0) > - ((node-is "}") parent-bol 0) > + ((node-is "}") standalone-parent 0) > ((node-is ")") parent-bol 0) > ((node-is "]") parent-bol 0) > ((node-is ">") parent-bol 0) > @@ -3465,9 +3465,9 @@ js--treesit-indent-rules > ((parent-is "member_expression") parent-bol js-indent-level) > ((node-is ,switch-case) parent-bol 0) > ;; "{" on the newline. > - ((node-is "statement_block") parent-bol js-indent-level) > + ((node-is "statement_block") parent-bol 0) > ((parent-is "named_imports") parent-bol js-indent-level) > - ((parent-is "statement_block") parent-bol js-indent-level) > + ((parent-is "statement_block") standalone-parent js-indent-level) > ((parent-is "variable_declarator") parent-bol js-indent-level) > ((parent-is "arguments") parent-bol js-indent-level) > ((parent-is "array") parent-bol js-indent-level) > @@ -3477,12 +3477,11 @@ js--treesit-indent-rules > ((parent-is "object_pattern") parent-bol js-indent-level) > ((parent-is "object") parent-bol js-indent-level) > ((parent-is "pair") parent-bol js-indent-level) > - ((parent-is "arrow_function") parent-bol js-indent-level) > + ((parent-is "arrow_function") grand-parent 0) > ((parent-is "parenthesized_expression") parent-bol js-indent-level) > ((parent-is "binary_expression") parent-bol js-indent-level) > ((parent-is "class_body") parent-bol js-indent-level) > ((parent-is ,switch-case) parent-bol js-indent-level) > - ((parent-is "statement_block") parent-bol js-indent-level) > ((match "while" "do_statement") parent-bol 0) > ((match "else" "if_statement") parent-bol 0) > ((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do") "_statement") > -- > 2.49.0
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Fri, 28 Mar 2025 09:54:02 GMT) Full text and rfc822 format available.Message #34 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Fri, 28 Mar 2025 10:53:01 +0100
Ciao Fabian, In data giovedì 27 marzo 2025 19:59:33 Ora standard dell’Europa centrale, Fabian Brosda ha scritto: > Hi Vincenzo, > > great that there is already an updated patch. I did test it and it looks > good for functions, conditionals, loops. Regarding arrow functions (or > variable declarations in general), the result is different, then with > js-mode, but personally I think the result looks more consistent in > js-ts-mode. Could you please show me this difference? > > There is one exception though. switch-case statements with the brace on > a separate line inside a function break js-ts-mode. But it is not really > a regression, it looks even worse without the patch :D > > I tried to add an attachment, with a few examples, but the mail delivery > was rejected. Therefore putting only the switch-case example inline > into the mail: > > js-mode: > > function switch_test(a) > { > switch (a) { > case 1: > x; > break; > case 2: > y; > break; > default: > z; > break; > } > > switch (a) > { > case 1: > x; > break; > case 2: > y; > break; > default: > z; > break; > } > } > > > js-ts-mode: > > function switch_test(a) > { > switch (a) { > case 1: > x; > break; > case 2: > y; > break; > default: > z; > break; > } > > switch (a) > { > case 1: > x; > break; > case 2: > y; > break; > default: > z; > break; > } > } > > Hope this works now. If you want more examples, I could put them in a > github gist, but the rest is not always exactly the same in both modes, > but imo fine either way. Thanks Fabian, more complex examples would be very helpful. I used the React sources and found more problems. Vincenzo > > Fabian > > Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > > Thank you Fabian. > > This new patch also fixes this problem in my tests. Can you please try it > > in your use cases? > > There would be some other things to fix as well, but maybe it would be > > better to do it in emacs 31. What do you think Eli? > > > > Vincenzo > > > > In data domenica 23 marzo 2025 20:20:56 Ora standard dell’Europa centrale, > > > > Fabian Brosda ha scritto: > >> Hi Vincenzo, > >> > >> all right, thanks for taking care of it. Just in case you don't already > >> know and maybe interesting, if the indentation should in fact be exactly > >> the same as in js-mode, I noticed, that your arrow function example is > >> indented differently. > >> > >> In js-mode: > >> > >> const Geek = (a, b) => > >> > >> { > >> > >> return (a + " " + b); > >> > >> } > >> > >> In js-ts-mode: > >> > >> const Geek = (a, b) => > >> > >> { > >> > >> return (a + " " + b); > >> > >> } > >> > >> js-indent-level is set to 4 in both cases. Looks like js-mode in general > >> aligns the part of a variable declaration, with the start of the > >> variable if you add a line break somewhere. > >> > >> Fabian > >> > >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > >> > Ciao Fabian, thank you. > >> > In fact, there are other cases where it does not work, and especially > >> > the > >> > behavior is different from js-mode. I need to think about this a bit > >> > more.. > >> > > >> > Vincenzo > >> > > >> > In data domenica 23 marzo 2025 11:18:02 Ora standard dell’Europa > >> > centrale, > >> > > >> > Fabian Brosda ha scritto: > >> >> Hi, > >> >> thanks for the explanation and the patch. The result from the patch > >> >> is > >> >> a GNU-style indentation, where only the braces for functions are not > >> >> indented, while braces for other blocks (if/else, loops, arrow > >> >> functions) are indented. > >> >> > >> >> What I would like to have is Allman style indentation, where the > >> >> braces > >> >> for blocks like if/else indent the same as for functions. This also > >> >> seems the default behavior in the old js-mode. In this case I think > >> >> it > >> >> would be correct to not indent the brace for the arrow function. For > >> >> reference, I found an issue in eslint regarding this indentation: > >> >> > >> >> https://github.com/eslint/eslint/issues/8493 > >> >> > >> >> Would it be possible to also support the later? > >> >> > >> >> Fabian > >> >> > >> >> Vincenzo Pupillo <v.pupillo <at> gmail.com> writes: > >> >> > 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 <at> debbugs.gnu.org > >> >> >> > Date: Sun, 09 Mar 2025 12:00:16 +0200 > >> >> >> > From: Eli Zaretskii <eliz <at> gnu.org> > >> >> >> > > >> >> >> > > 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" <bug-gnu-emacs <at> gnu.org> > >> >> >> > > > >> >> >> > > 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/progmode > >> >> >> > > s/j > >> >> >> > > s.e > >> >> >> > > l# > >> >> >> > > 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? > >> >> > > >> >> > From 56f0bfe99b0c4cda1e36686e48c58d0d017bda21 Mon Sep 17 00:00:00 > >> >> > 2001 > >> >> > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > >> >> > Date: Sat, 22 Mar 2025 23:43:52 +0100 > >> >> > Subject: [PATCH] Fix indentation of "{" when on a new line of a > >> >> > function > >> >> > > >> >> > declaration. > >> >> > > >> >> > * lisp/progmodes/js.el > >> >> > (js--treesit-indent-rules): New rule for the indentation of "{" when > >> >> > of a new line of a function declaration. (bug#76704) > >> >> > --- > >> >> > > >> >> > lisp/progmodes/js.el | 5 ++++- > >> >> > 1 file changed, 4 insertions(+), 1 deletion(-) > >> >> > > >> >> > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > >> >> > index 3e789218fde..6943ffc2d28 100644 > >> >> > --- a/lisp/progmodes/js.el > >> >> > +++ b/lisp/progmodes/js.el > >> >> > @@ -3464,7 +3464,10 @@ js--treesit-indent-rules > >> >> > > >> >> > ((parent-is "ternary_expression") parent-bol > >> >> > js-indent-level) > >> >> > ((parent-is "member_expression") parent-bol js-indent-level) > >> >> > ((node-is ,switch-case) parent-bol 0) > >> >> > > >> >> > - ;; "{" on the newline. > >> >> > + ;; "{" on the newline for functions. > >> >> > + ((query "(function_declaration body: (statement_block \"{\") > >> >> > @indent)") + parent-bol 0) > >> >> > + ;; "{" on the newline in other cases. > >> >> > > >> >> > ((node-is "statement_block") parent-bol js-indent-level) > >> >> > ((parent-is "named_imports") parent-bol js-indent-level) > >> >> > ((parent-is "statement_block") parent-bol js-indent-level) > > > > From 2d715869962c3720c80ec3009adade5dd3c4c8b1 Mon Sep 17 00:00:00 2001 > > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > > Date: Sat, 22 Mar 2025 23:43:52 +0100 > > Subject: [PATCH] Fix indentation of "{" when on a new line of a function > > > > declaration. > > > > * lisp/progmodes/js.el > > (js--treesit-indent-rules): Fix rule for the indentation of "{" when > > of a new line of a function declaration. (bug#76704) > > Fix other related rules. > > --- > > > > lisp/progmodes/js.el | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > > index 3e789218fde..802d74103df 100644 > > --- a/lisp/progmodes/js.el > > +++ b/lisp/progmodes/js.el > > @@ -3454,7 +3454,7 @@ js--treesit-indent-rules > > > > (let ((switch-case (rx "switch_" (or "case" "default")))) > > > > `((javascript > > > > ((parent-is "program") parent-bol 0) > > > > - ((node-is "}") parent-bol 0) > > + ((node-is "}") standalone-parent 0) > > > > ((node-is ")") parent-bol 0) > > ((node-is "]") parent-bol 0) > > ((node-is ">") parent-bol 0) > > > > @@ -3465,9 +3465,9 @@ js--treesit-indent-rules > > > > ((parent-is "member_expression") parent-bol js-indent-level) > > ((node-is ,switch-case) parent-bol 0) > > ;; "{" on the newline. > > > > - ((node-is "statement_block") parent-bol js-indent-level) > > + ((node-is "statement_block") parent-bol 0) > > > > ((parent-is "named_imports") parent-bol js-indent-level) > > > > - ((parent-is "statement_block") parent-bol js-indent-level) > > + ((parent-is "statement_block") standalone-parent js-indent-level) > > > > ((parent-is "variable_declarator") parent-bol js-indent-level) > > ((parent-is "arguments") parent-bol js-indent-level) > > ((parent-is "array") parent-bol js-indent-level) > > > > @@ -3477,12 +3477,11 @@ js--treesit-indent-rules > > > > ((parent-is "object_pattern") parent-bol js-indent-level) > > ((parent-is "object") parent-bol js-indent-level) > > ((parent-is "pair") parent-bol js-indent-level) > > > > - ((parent-is "arrow_function") parent-bol js-indent-level) > > + ((parent-is "arrow_function") grand-parent 0) > > > > ((parent-is "parenthesized_expression") parent-bol > > js-indent-level) > > ((parent-is "binary_expression") parent-bol js-indent-level) > > ((parent-is "class_body") parent-bol js-indent-level) > > ((parent-is ,switch-case) parent-bol js-indent-level) > > > > - ((parent-is "statement_block") parent-bol js-indent-level) > > > > ((match "while" "do_statement") parent-bol 0) > > ((match "else" "if_statement") parent-bol 0) > > ((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do") > > "_statement")> > > -- > > 2.49.0
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Fri, 28 Mar 2025 10:54:02 GMT) Full text and rfc822 format available.Message #37 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Fri, 28 Mar 2025 11:53:49 +0100
Hi Vincenzo, >> great that there is already an updated patch. I did test it and it looks >> good for functions, conditionals, loops. Regarding arrow functions (or >> variable declarations in general), the result is different, then with >> js-mode, but personally I think the result looks more consistent in >> js-ts-mode. > Could you please show me this difference? The examples are not really complex, just a few maybe a bit unusual cases I could think of. You can find the gist containing the js-mode and js-ts-mode (including your latest patch) version and a diff here: https://gist.github.com/fbrosda/11870561bb009be87b719d5b9a7aa625 A short summary: - Declaring a variable and assigning an arrow function, the braces are not indented in js-ts-mode, but indented to the start of the variable in js-mode (also compare the difference between let and const) - Similar cases, when having a line break in a variable declaration. js-ts-mode uses the fixed indentation js-indent-level, while js-mode indents to the start of the variable name. Observe the difference between const and let. I personally prefer the js-ts-mode, so that const and let, if you mix the two. But at least in my code, this is normally used very rarely, so both versions are fine. - switch-cases have a few differences. For switch with the { on a separate line, it is imo wrong in js-mode to indent the case statements, as the blocks inside the case are not further indented. Switches inside a function break in js-ts-mode, as they have a nega Hope this helps. Fabian
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Tue, 01 Apr 2025 21:05:02 GMT) Full text and rfc822 format available.Message #40 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Tue, 01 Apr 2025 23:04:14 +0200
[Message part 1 (text/plain, inline)]
Ciao Fabian, this updated patch fix all yours example and others corner case of arrow function, chained member expression. For switch body indentation now possible to use js-switch-indent-offset as in js-mode. js-chain-indent can be used to achieve the same behavior as js-mode for that chained member expression. Can you please try it again? Vincenzo In data venerdì 28 marzo 2025 11:53:49 Ora legale dell’Europa centrale, Fabian Brosda ha scritto: > Hi Vincenzo, > > >> great that there is already an updated patch. I did test it and it looks > >> good for functions, conditionals, loops. Regarding arrow functions (or > >> variable declarations in general), the result is different, then with > >> js-mode, but personally I think the result looks more consistent in > >> js-ts-mode. > > > > Could you please show me this difference? > > The examples are not really complex, just a few maybe a bit unusual > cases I could think of. You can find the gist containing the js-mode > and js-ts-mode (including your latest patch) version and a diff here: > > https://gist.github.com/fbrosda/11870561bb009be87b719d5b9a7aa625 > > A short summary: > > - Declaring a variable and assigning an arrow function, the braces are > not indented in js-ts-mode, but indented to the start of the variable > in js-mode (also compare the difference between let and const) > - Similar cases, when having a line break in a variable declaration. > js-ts-mode uses the fixed indentation js-indent-level, while js-mode > indents to the start of the variable name. Observe the difference > between const and let. I personally prefer the js-ts-mode, so that > const and let, if you mix the two. But at least in my code, this is > normally used very rarely, so both versions are fine. > - switch-cases have a few differences. For switch with the { on a > separate line, it is imo wrong in js-mode to indent the case > statements, as the blocks inside the case are not further indented. > Switches inside a function break in js-ts-mode, as they have a nega > > > Hope this helps. > > Fabian
[0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Wed, 02 Apr 2025 08:52:02 GMT) Full text and rfc822 format available.Message #43 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Wed, 02 Apr 2025 10:51:05 +0200
Hi Vincenzo, > For switch body indentation now possible to use js-switch-indent-offset as in > js-mode. Testing this, the results are different in js-mode and js-ts-mode. js-mode applies the offset only if the brace is on the same line, while js-ts-mode applies it only, if the brace is on a separate line. I updated the gist, and used js-switch-indent-offset = 2, to distinguish it from the regular indentation. > Can you please try it again? I also tested in a couple of projects and found one difference when using ternary operators and putting the whole expression in parenthesis. I also added it to the gist. Note, that only the combination of parenthesis and ternary operator is different, the other two cases are the same. But otherwise I could not find any more differences and the original case with braces on separate lines also works very well :-) Fabian
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Wed, 02 Apr 2025 21:18:01 GMT) Full text and rfc822 format available.Message #46 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Wed, 02 Apr 2025 23:17:10 +0200
[Message part 1 (text/plain, inline)]
Ciao Fabian, I've fixed these two things (I hope!). The new patch is attached. Vincenzo In data mercoledì 2 aprile 2025 10:51:05 Ora legale dell’Europa centrale, Fabian Brosda ha scritto: > Hi Vincenzo, > > > For switch body indentation now possible to use js-switch-indent-offset as > > in js-mode. > > Testing this, the results are different in js-mode and js-ts-mode. js-mode > applies the offset only if the brace is on the same line, while > js-ts-mode applies it only, if the brace is on a separate line. I > updated the gist, and used js-switch-indent-offset = 2, to distinguish > it from the regular indentation. > > > Can you please try it again? > > I also tested in a couple of projects and found one difference when > using ternary operators and putting the whole expression in parenthesis. > I also added it to the gist. Note, that only the combination of > parenthesis and ternary operator is different, the other two cases are > the same. > > But otherwise I could not find any more differences and the original > case with braces on separate lines also works very well :-) > > Fabian
[0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Mon, 07 Apr 2025 07:34:03 GMT) Full text and rfc822 format available.Message #49 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Fabian Brosda <f.brosda <at> gmx.de> To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Mon, 07 Apr 2025 09:33:26 +0200
Hi Vincenzo, thanks for the new patch. The results look very good and I couldn't find any example, which gives unexpected indentation in js-ts-mode now. Regarding the use of js-switch-indent-offset for js-mode, the results are still different, depending on the brace being on the same line or not. Should I open a separate bug report for this? Again thanks for your time and the prompt updates. Fabian
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Mon, 07 Apr 2025 09:40:01 GMT) Full text and rfc822 format available.Message #52 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: juri <at> linkov.net, Eli Zaretskii <eliz <at> gnu.org>, Fabian Brosda <f.brosda <at> gmx.de>, Daniel Colascione <dancol <at> dancol.org> Cc: 76704 <at> debbugs.gnu.org Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Mon, 07 Apr 2025 11:39:25 +0200
Ciao Fabian, In data lunedì 7 aprile 2025 09:33:26 Ora legale dell’Europa centrale, Fabian Brosda ha scritto: > Hi Vincenzo, > > thanks for the new patch. The results look very good and I couldn't > find any example, which gives unexpected indentation in js-ts-mode now. > > Regarding the use of js-switch-indent-offset for js-mode, the results > are still different, depending on the brace being on the same line or > not. Should I open a separate bug report for this? whith js-switch-indent-offset = 2 and js-indent-offset = 4, with js-mode the result is: function switch_test(a) { switch (a) { case 1: x; break; case 2: y; break; default: z; break; } switch (a) { case 1: x; break; case 2: y; break; default: z; break; } } js-ts-mode the result is: function switch_test(a) { switch (a) { case 1: x; break; case 2: y; break; default: z; break; } switch (a) { case 1: x; break; case 2: y; break; default: z; break; } } For me the js-ts mode is correct, but I am not an expert. @Daniel WDYT? Vincenzo > > Again thanks for your time and the prompt updates. > > Fabian
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sat, 19 Apr 2025 13:41:01 GMT) Full text and rfc822 format available.Message #55 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Vincenzo Pupillo <v.pupillo <at> gmail.com> Cc: f.brosda <at> gmx.de, 76704 <at> debbugs.gnu.org, juri <at> linkov.net Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sat, 19 Apr 2025 16:40:31 +0300
> From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > Cc: 76704 <at> debbugs.gnu.org > Date: Wed, 02 Apr 2025 23:17:10 +0200 > > Ciao Fabian, I've fixed these two things (I hope!). > > The new patch is attached. I wanted to install this, but it no longer applies cleanly. Could you please rebase on the current master and resubmit?
bug-gnu-emacs <at> gnu.org
:bug#76704
; Package emacs
.
(Sat, 19 Apr 2025 21:10:01 GMT) Full text and rfc822 format available.Message #58 received at 76704 <at> debbugs.gnu.org (full text, mbox):
From: Vincenzo Pupillo <v.pupillo <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: f.brosda <at> gmx.de, 76704 <at> debbugs.gnu.org, juri <at> linkov.net Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sat, 19 Apr 2025 23:09:32 +0200
[Message part 1 (text/plain, inline)]
Ciao Eli, In data sabato 19 aprile 2025 15:40:31 Ora legale dell’Europa centrale, Eli Zaretskii ha scritto: > > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > > Cc: 76704 <at> debbugs.gnu.org > > Date: Wed, 02 Apr 2025 23:17:10 +0200 > > > > Ciao Fabian, I've fixed these two things (I hope!). > > > > The new patch is attached. > > I wanted to install this, but it no longer applies cleanly. Could you > please rebase on the current master and resubmit? Done, the attached patch is rebased against the master. Thanks. Vincenzo
[0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch (text/x-patch, attachment)]
Eli Zaretskii <eliz <at> gnu.org>
:Fabian Brosda <f.brosda <at> gmx.de>
:Message #63 received at 76704-done <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Vincenzo Pupillo <v.pupillo <at> gmail.com> Cc: f.brosda <at> gmx.de, 76704-done <at> debbugs.gnu.org, juri <at> linkov.net Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Date: Sun, 20 Apr 2025 09:16:02 +0300
> From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > Cc: juri <at> linkov.net, f.brosda <at> gmx.de, 76704 <at> debbugs.gnu.org > Date: Sat, 19 Apr 2025 23:09:32 +0200 > > Ciao Eli, > > In data sabato 19 aprile 2025 15:40:31 Ora legale dell’Europa centrale, Eli > Zaretskii ha scritto: > > > From: Vincenzo Pupillo <v.pupillo <at> gmail.com> > > > Cc: 76704 <at> debbugs.gnu.org > > > Date: Wed, 02 Apr 2025 23:17:10 +0200 > > > > > > Ciao Fabian, I've fixed these two things (I hope!). > > > > > > The new patch is attached. > > > > I wanted to install this, but it no longer applies cleanly. Could you > > please rebase on the current master and resubmit? > Done, the attached patch is rebased against the master. Thanks, installed on master, and closing the bug.
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sun, 18 May 2025 11:24:06 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.