Bug 189255 - [content assist] code assist should fix indentation
Summary: [content assist] code assist should fix indentation
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-25 20:37 EDT by Olivier Thomann CLA
Modified: 2007-05-28 09:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2007-05-25 20:37:20 EDT
Following the steps in bug 185928 comment 0, I still don't get what I expect, but the comment is properly indented.
Comment 1 Dani Megert CLA 2007-05-26 05:36:50 EDT
It would help if you indicated what YOU expected. Closing as WORKSFORME as it is what's expected as reported in bug 185928.
Comment 2 Olivier Thomann CLA 2007-05-26 16:34:49 EDT
I expect the method to also be indented as my formatter prefs specify that methods should be indented from the class definition.
Comment 3 Olivier Thomann CLA 2007-05-26 16:40:14 EDT
(In reply to comment #1)
> It would help if you indicated what YOU expected. Closing as WORKSFORME as it
> is what's expected as reported in bug 185928.
I indicated what I expected to see in bug 185928 comment 80.

Comment 4 Dani Megert CLA 2007-05-27 05:33:20 EDT
We insert the new code formatted but we do not change your chosen input position. If you type 'foo' at the beginning of the line then we won't indent the method. Similar as if you do code assist somewhere inside a method: we insert the proposal and never correct the indentation.
Comment 5 Dani Megert CLA 2007-05-28 08:02:21 EDT
Reopening as enhancement request: provide an option to correct indentation while doing code assist.

Olivier, what about this:

    correctlyIndentedLine();
        foo.bar.co<code assist>

Would you also want the indentation fixed in this case?
Comment 6 Olivier Thomann CLA 2007-05-28 08:39:47 EDT
(In reply to comment #5)
> Olivier, what about this:
> 
>     correctlyIndentedLine();
>         foo.bar.co<code assist>
Ideally yes, but I would expect that this line is already indented when I start typing "foo....".
Comment 7 Dani Megert CLA 2007-05-28 09:03:10 EDT
>Ideally yes, but I would expect that this line is already indented when I start
>typing "foo....".
This would be the case if you pressed Return after the correctlyIndentedLine(). Do you mean it should also auto-indent if you start typing <here>?

    correctlyIndentedLine();
<type 'f' here>
==>
    correctlyIndentedLine();
    f

i.e. auto-indentation on typing?
Comment 8 Olivier Thomann CLA 2007-05-28 09:10:16 EDT
Ideally I'd like the resulting source to be as close as possible from what the formatter would return once it is invoked.
If you set your formatter options to indent method declaration relative to the type declaration and this is not respected when a new method is added, then this is as serious as the problem with the two new options (NEVER...) for positioning the comments on first columns.
If this means having auto-indentation on typing, then yes.
Comment 9 Dani Megert CLA 2007-05-28 09:28:39 EDT
>and this is not respected when a new method is added
Just to clarify: I was talking about the general case i.e. you just start typing 'f' and for the editor it's of course not obvious what you're going to do (like maybe inserting a method via code assist). So - would you want 'f' to get auto-indented as soon as you type it? 

Or is it rather that you only want larger code snippets be auto-indented but not when inserting a method name (and its parameters) via code assist?