Tabifier plugin - feature request - feedback welcome

Dear Tabifier users,

I've received a feature request from Adam Winter to align commas in consecutive method calls. I am wondering if you would find this useful and would especially like your feedback on the proposed configuration controls to implement it.

For example, Adam would like

to appear as:

I'm proposing that tabifier be enhanced to optionally align parameters of consecutive method call statements. It would ignore any multiline method calls (these are already handled to some degree by IDEA's code layout options.)

The syntactic columns that could be aligned are:
- opening parend
- parameters
- commas
- close parend
- optionally treat close parend as alignable with comma (useful when number of parameters is different)
- semicolon
- trailing comment

Each could be selected independently, with number of spaces or tabs specified, similar to the way it currently handles declarations and assignment statements, but with necessary substitution of syntactic items for method calls.

To take an example:

Tabifier could replace it with any of the following, depending on your choice of settings. In these examples, assume a single space is appended to the previous column for alignment.

Align parameters only

Align commas
Parameters automatically have one space after preceding comma so appear to be aligned also.

Align parameters, open and close parentheses

Align parameters, open and close parentheses, and treat close parend as comma for alignment purposes

Thanks for your feedback.
-Dave

-


Original Message-----
From: Adam Winter
Sent: Tuesday, June 03, 2003 10:01 PM
To: Dave Kriewall
Subject: Re: tabifier


Hi, I took a closer look at the code, and realized I was probably
mistaken. I was under the impression that the aligning of commas would
transform:

into:

But after looking at the code realized that it only deals with commas
at the end of the line.

So, keeping the commas/semicolons together is fine, but can commas in
method arguments be aligned?

-adamw

2 comments
Comment actions Permalink

Yup, I'd really like the ability to format method calls, with my preference being for the "Align parameters, open and close parentheses" option. I was, as in my email, thinking mostly of aligning the parameters of consecutive calls to the same method, which is something I do frequently, but you're correct in mentioning the need to group the consecutive calls together.

-adamw

0
Comment actions Permalink

In that case, perhaps we need several grouping options (where groups are tabified independently of other groups):

- group all calls to the same method -- i.e. different method calls are tabified independently. This addresses your case of consecutive calls to the same method. If not checked, calls to any method would be grouped together.

- blank lines separate groups (same as current option).

- non-blank, non-method call lines separate groups. If not checked, intervening statements (e.g. assignment statements) would not break up the grouping, e.g. unchecked result would be:


This last option starts to get tricky when considered in conjunction with the existing option that "non-blank lines separate groups of assignments and declarations." I think I'd have to make two passes, one for assignments and declarations (to get that grouping correct), and another pass for method calls. For example, if both "non-blank" options are unchecked:

the assignment statements are formatted together, and the method calls are formatted together, even though an intervening non-blank line occurs.

What I really need is a preview pane capability, but am still waiting for a reply from IntelliJ on whether/how that is possible.

Do these grouping options satisfy your needs?

0

Please sign in to leave a comment.