Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiline function calls confuse the indenter #4

Closed
artm opened this issue Dec 10, 2010 · 3 comments
Closed

multiline function calls confuse the indenter #4

artm opened this issue Dec 10, 2010 · 3 comments

Comments

@artm
Copy link
Contributor

artm commented Dec 10, 2010

sometimes I have several longish arguments/expressions to a function call so I want to break the function call into something like (manually formatted):

fun( longish_argument,
     some_expression() * 2.0 + x - 130.0,
     nested_function_call( indent_me,
                           thanks ),
     still_more_arguments);

the following is formatted with 'gg=G' with vim-javascript indenter:

/*
* the arguments below are short to make a more readable test case, but the
* point of this formatting is to be able to break function calls with long
* arguments...
*/

fun(1,
    2,
    3);
    // doesn't return
    fun(1,
        2,
        3
       );
       // doesn't either
       fun(
         1,
         2,
         3);
         // again
         fun(
           1,
           2,
           3
         ); 
         // this is the only one working, but even it breaks in some contexts

         switch(foo) {
           case 1:
             here(
               1,
           2, // why????
           );
           here(
             1,
             2,
             3
           ); // seems recovered, but it's misindented
           break;
           case 2:
             here(
               1,
           2
           ); // so it breaks after each case
           break;
         }

I'd be happy to help changing the indenter, but I'm lost in the script, could you explain the logic behind it?

@pangloss
Copy link
Owner

It might help you to figure out the code if you check out the with_tracing branch...

@artm
Copy link
Contributor Author

artm commented Dec 10, 2010

I see. I was wondering what they were...

@artm
Copy link
Contributor Author

artm commented Dec 10, 2010

oops, wrong button, I didn't intend to close the issue, sorry

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants