Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Pattern-Based Formatter Prototype

Hi Dave,

I finally had some time to look at what you did. It is really nice. I look
at the list of missing functionalities and general observation. See my
comments at the bottom. Thanks for the work you have done on this
prototype.

The first goal we have is to get something working at least as good as the
actual formatter (which, I agree, is not great) and improve the maintenance
and the flexibility of the formatter. I need to get more familiar with
regular expressions syntax before I can really try your proto.

I summarize some of the issues we'd like to improve:

1) Indentation
- anonymous class (3181)
- remove indentation in front of methods (3276)
- indent with spaces add an extra boggus space (5691)
- set a maximum level for indentation (6284)
- customizable continuation indentation (6284, 14659)
- align variable initializations (6284)
- indentation of multiple parameters (11381)
- "compressed" closing brackets '}' (12086)

2) Blank lines
- ensure one empty line before method declaration (3327)
- leave all blank lines (6747)
- remove all blank lines (6747)
- replace xx blank lines with n blank lines (6747)
- Allow trailing whitespace to be optionally retained(10160)

3) Casting
- option for casting without spaces (compact cast) (6301)

4) Split
- wrong splitting of import declarations (7224)
- improve line splitting (10052)
- indentation of multiple parameters (11381)
- improve management of end of line comments (16225)

5) throws clause
- option to place the throw clause relative to the method declaration
(12092)

6) spaces
- spaces and parenthesis and braces (12456)
- spaces and keywords (12456)

7) arrays
- improve formatting of arrays initializers (16231)

8) Comments
- no new line after a block comment if the comment is on a single line
(19698)

9) coding style
- define customized style
- define predefined styles according to coding conventions (GNU, Sun, etc.)

I have some questions for you.

1) You don't talk too much about the selection of a rule rather than
another one. For example, the distinction between a casting and the
arguments of a method.
2) How do you think it is possible to add the mapping between positions
before formatting and positions after formatting?
3) If I well understood, only the Cfss parts depend on ANTLR. For licencing
issues, we might want to get rid of this dependency.
4) How confident are you to be able to address the improvements listed
above with this approach?

Thanks,

Olivier



Back to the top