GNU bug report logs - #9151
js-mode indentation doesn't recognize brace-less function expressions

Previous Next

Package: emacs;

Reported by: Štěpán Němec <stepnem <at> gmail.com>

Date: Fri, 22 Jul 2011 19:34:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Jakub Ječmínek <kuba <at> kubajecminek.cz>
To: Knut Olav Bøhmer <bohmer <at> gmail.com>
Cc: 9151 <at> debbugs.gnu.org
Subject: bug#9151: js-mode indentation doesn't recognize brace-less function expressions
Date: Mon, 03 Jun 2024 19:48:01 +0000
Knut Olav Bøhmer <bohmer <at> gmail.com> writes:

> Right:
> const something = () =>
>       indent_like_this();
>
> Wrong:
> const something = () =>
> not_indent_like_this();

This indents correctly for me.


Štěpán Němec <stepnem <at> gmail.com> writes:

> In JavaScript, the following is a valid function definition:
>
> function foo ()
>     a.somewhat().complicated()
>     .computation()
>
> but `js-mode' currently indents it like this:
>
> function foo ()
> a.somewhat().complicated()
>     .computation()

I know virtually nothing about JavaScript but your example function
doesn't seem valid.  If you add curly braces and set `js-chain-indent'
to t then it works fine.





This bug report was last modified 1 year and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.