| Huge auto-indent after opening bracket + line feed [message #219976] |
Fri, 02 December 2005 06:08  |
Eclipse User |
|
|
|
Originally posted by: Alexander.Kriegisch.web.de
My coding style is such that I want to use indentation in multi-line
expressions surrounded by round or square brackets. The indentation
mechanism should work in a way analogous to curly brace indentation.
Currently, whenever I press [Return] after an opening bracket, the
following line is indented by multiple tab levels, not just one as
expected.
1. For example, I want my code to look like this (I am replacing each tab
by four dots because I assume the web interface for this newsgroup will
kill my leading spaces):
void foo()
{
....if
....(
........currentSquare.getY() == 7 ||
........board.isBlocked
........(
............newX = currentSquare.getX(),
............newY = currentSquare.getY() + 1
............)
....)
........return false;
}
2. What it does look like when manually pressing [Return] after each line,
though, is this:
void foo()
{
....if
....(
....................currentSquare.getY() == 7 ||
....................board.isBlocked
....................(
........................newX = currentSquare.getX(),
........................newY = currentSquare.getY() + 1)
........................)
........return false;
}
3. When applying auto-format (Ctrl-Shift-F), it looks still different:
void foo()
{
....if (currentSquare.getY() == 7
........|| board.isBlocked(
............newX = currentSquare.getX(), newY = currentSquare.getY() + 1))
........return false;
}
4. When applying auto-indent (Ctrl-I), there is yet another variant:
void foo()
{
....if (currentSquare.getY() == 7
....................|| board.isBlocked(
........................newX = currentSquare.getX(), newY =
currentSquare.getY() + 1))
........return false;
}
First of all, I don't understannd why #3 and #4 are different at all. I
assume auto-indent should just be a subset of auto-format. The latter
modifies line-wrapping and subsequently applies auto-indent. At least this
is what I expected. Obviously my assumption is wrong for Eclipse 3.1.
Secondly, I would like to know if there is a way to achieve
auto-indentation like in #1 in the editor as well as in the formatter
preferences. Do I have to extend any Eclipse classes myself or is it
possible to do this via parametrisation?
Thanks in advance
|
|
|
|
|
| Re: Huge auto-indent after opening bracket + line feed [message #220080 is a reply to message #219976] |
Tue, 06 December 2005 06:07  |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.eclipse.org
Alexander Kriegisch wrote:
> My coding style is such that I want to use indentation in multi-line
> expressions surrounded by round or square brackets. The indentation
> mechanism should work in a way analogous to curly brace indentation.
> Currently, whenever I press [Return] after an opening bracket, the
> following line is indented by multiple tab levels, not just one as
> expected.
I suggest you file a bug report with steps to reproduce.
Dani
>
> 1. For example, I want my code to look like this (I am replacing each
> tab by four dots because I assume the web interface for this newsgroup
> will kill my leading spaces):
>
> void foo()
> {
> ...if
> ...(
> .......currentSquare.getY() == 7 ||
> .......board.isBlocked
> .......(
> ...........newX = currentSquare.getX(),
> ...........newY = currentSquare.getY() + 1
> ...........)
> ...)
> .......return false;
> }
>
> 2. What it does look like when manually pressing [Return] after each
> line, though, is this:
>
> void foo()
> {
> ...if
> ...(
> ...................currentSquare.getY() == 7 ||
> ...................board.isBlocked
> ...................(
> .......................newX = currentSquare.getX(),
> .......................newY = currentSquare.getY() + 1)
> .......................)
> .......return false;
> }
>
> 3. When applying auto-format (Ctrl-Shift-F), it looks still different:
>
> void foo()
> {
> ...if (currentSquare.getY() == 7
> .......|| board.isBlocked(
> ...........newX = currentSquare.getX(), newY = currentSquare.getY() + 1))
> .......return false;
> }
>
> 4. When applying auto-indent (Ctrl-I), there is yet another variant:
>
> void foo()
> {
> ...if (currentSquare.getY() == 7
> ...................|| board.isBlocked(
> .......................newX = currentSquare.getX(), newY =
> currentSquare.getY() + 1))
> .......return false;
> }
>
>
> First of all, I don't understannd why #3 and #4 are different at all.
> I assume auto-indent should just be a subset of auto-format. The
> latter modifies line-wrapping and subsequently applies auto-indent. At
> least this is what I expected. Obviously my assumption is wrong for
> Eclipse 3.1.
>
> Secondly, I would like to know if there is a way to achieve
> auto-indentation like in #1 in the editor as well as in the formatter
> preferences. Do I have to extend any Eclipse classes myself or is it
> possible to do this via parametrisation?
>
> Thanks in advance
>
|
|
|
Powered by
FUDForum. Page generated in 0.04591 seconds