[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8576: 23.2; js-mode doesn't support multi-line variable declarations

From: Daniel Colascione
Subject: bug#8576: 23.2; js-mode doesn't support multi-line variable declarations
Date: Sun, 19 Jun 2011 13:38:06 -0700
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20110414 Thunderbird/3.1.10

Hash: SHA1

Hi Felix,

Thanks for the bug report.

On 4/28/11 12:22 AM, Felix H. Dahlke wrote:
> The problem can be reproduced as follows:
> 1. Open a JavaScript file or load js-mode
> 2. Insert the following code:
>    var i = 1,
>        j = 2;
> 3. Observe that "j" is not highlighted and that pressing TAB on the
> second line doesn't indent it correctly.
> Highlighting works correctly if both variables are declared on the
> same line:
>     var i = 1, j = 2;

After looking at what would be required to address this bug, I'd like to
leave it unfixed for now:

The machinery required to implement the tracking necessary to handle
this construct in a generic way would be quite complex. Simple cases
could perhaps be recognized more quickly, but such a solution would fail
in hard to predict ways. Long-range effects are notoriously difficult to
recognize in font-lock, and reliably rehighlighting them after a change
is even trickier.

Additionally, this construct is relatively rare; if you're going to
split variable declarations across several lines, you might as well use
another "var". Also, the existing highlighting has no ill effects: the
second declaration is just interpreted as an assignment, and the worst
part is a lack of font-lock-variable-name-face, not syntactic incoherence.

I'll take patches, but for now, I think we should defer a solution to
this issue until we have a more sophisticated and general highlighting
Version: GnuPG v1.4.11 (Darwin)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]