Hirohito Higashi wrote:

> Hi Bram and List,
> 
> JavaScript indent (:help cino-J) is incorrect.
> 
> How to reproduce:
> 1. Run Vim. (Note: sample.js is attached on this mail)
>   $ vim -N -u NONE --cmd "filetype indent on" -c "set et ts=4 sw=0" sample.js
> 
> 2. Indent the entire file.
>   gg=G
> 
> Indent result:
> -------- Indented sample.js start --------
> // (1)
> (function(){
>     var a = [
>         'a',
>         'b',
>         'c',
>             'd',                  // NG1
>             'e',            // NG1
>                 'f',        // NG1
>                 'g',        // NG1
>                     'h',    // NG1
>                     'i'     // NG1
>     ];
> }())
> 
> // (2)
> (function(){
>     var a = [
>         0 +
>         5 *                   // NG2
>         9 *                   // NG2
>         'a',          // NG2
>         'b',
>         0 +
>             5 *
>             9 *
>             'c',
>             'd',      // NG3
>             'e',
>                 'f',
>                 'g',
>                     'h',
>                     'i'
>     ];
> }())
> 
> // (3)
> {
>     var a = [
>         [
>         0,      // NG4
>         1       // NG4
>         ],
>         2,
>         3
>     ];
> }
> 
> // (4)
> {
>     var a = [
>         // [
>         0,
>         // 1
>         // ],
>         2,
>             3         // NG5
>     ];
> }
> -------- Indented sample.js end --------
> 
> What's incorrect:
> NG1: Useless indentation increase every two lines.
> NG2: When Item is over the multi lines, It should be further indented lines 
> after the first.
> NG3: Different from the first line of indentation of the previous item.
> NG4: Item in the nested array is not indented.
> NG5: Bad indentation in response to start bracket in the comments. (*1)
> 
> 
> What is expected behavior:
> Please refer to the attaching sample_ok.js.
> 
> 
> I wrote a patch that fix these problems.
> Please check and include this.
> 
> (*1) This time I did an ad-hoc modifications.
>     To the formal correspondence we need to implement FM_SKIPCOMM in flags of 
> 3rd argument of findmatchlimit().
>     >  *        FM_SKIPCOMM   skip comments (not implemented yet!)

Thanks.  I'll look into it.  The builtin indenting code keeps getting
more complex, but I suppose it will be difficult to make it better
without doing a complete overhoal.

-- 
DEAD PERSON:  I don't want to go in the cart!
CUSTOMER:     Oh, don't be such a baby.
MORTICIAN:    I can't take him...
DEAD PERSON:  I feel fine!
CUSTOMER:     Oh, do us a favor...
MORTICIAN:    I can't.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui