Bug 70099 - Source formatting: support indented throws clauses
Summary: Source formatting: support indented throws clauses
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 3.1 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-15 08:55 EDT by Jan Ploski CLA
Modified: 2005-01-11 11:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Ploski CLA 2004-07-15 08:55:10 EDT
I prefer my "throws" clauses to appear indented by one on the line following
a method's parameter list:

public void foo(..)
    throws SomeException
{
}

It seems impossible to achieve this effect using the current Code Formatter.

Also, consider the following situation

public void foo(..)<caret is here> throws SomeException
{
}

When I hit enter, the "throws" clause lands on the following line in the
same column as "public":

public void foo(..)
throws SomeException
{
}

I would prefer "throws" to be auto-indented, and as far as I recall,
Eclipse 2.1.x behaved that way.
Comment 1 Frederic Fusier CLA 2004-07-19 06:43:18 EDT
There was no auto-intendation with 2.1.x in this case (when you hit return
throws clause lands on same column than public).
There was also no possibility to change this using code formatter in 2.1.x...

However, in 3.0, code formatter allows you to have this formatting:
Go on "Line Wrapping" tab, then select MethodDeclaration->'throws' clause and
choose:
'Line wrapping policy' = "Always wrap first element, others when necessary"
'Indentation policy'   = "Default indentation"
Force split            = ON
Then you should see you 'throws' clause go one line below and indented as you're
expected...

Note that you have many other policies ("Wrap all alements...") which will put
'htrows' clause on next line and indented. The difference will be only on how
following classes in clause will be formatted.