Bug 406463 - [templates][content assist] Ctrl+Space without any starting letter shows to no templates
Summary: [templates][content assist] Ctrl+Space without any starting letter shows to n...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 32971 (view as bug list)
Depends on:
Blocks: 496661
  Show dependency tree
 
Reported: 2013-04-24 12:34 EDT by Lars Vogel CLA
Modified: 2020-08-03 02:07 EDT (History)
4 users (show)

See Also:


Attachments
Patch (747 bytes, patch)
2013-04-24 15:41 EDT, Lars Vogel CLA
no flags Details | Diff
Patch (23.95 KB, patch)
2013-04-26 03:24 EDT, Lars Vogel CLA
no flags Details | Diff
N&N patch (23.95 KB, patch)
2013-04-26 04:34 EDT, Lars Vogel CLA
no flags Details | Diff
Screensho (17.85 KB, image/png)
2013-04-26 04:36 EDT, Lars Vogel CLA
no flags Details
N&N patch (1.12 KB, patch)
2013-04-26 07:40 EDT, Lars Vogel CLA
no flags Details | Diff
Conflicts (53.85 KB, image/png)
2013-04-26 07:51 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2013-04-24 12:34:41 EDT
I finally realized that the "empty" CTRL+Space does not show any templates. I think it would be much more helpful if the empty statement show all templates.

Example:

No line in the editor-> CTRL+Space should display all templates.

B-> CTRL+Space shows Browser and Button template.

I would assume that this change would be relatively easily, please feel free to guide me to the right class so that I can try to fix that.
Comment 1 Lars Vogel CLA 2013-04-24 15:41:16 EDT
Created attachment 230092 [details]
Patch

Patch attached.

I really like this change, I think it makes templates much more visible and useful.
Comment 2 Dani Megert CLA 2013-04-25 03:22:43 EDT
I need to think about it for a while. If we enable this, then I'd definitely also want to enable for keywords.
Comment 3 Dani Megert CLA 2013-04-25 03:23:19 EDT
*** Bug 32971 has been marked as a duplicate of this bug. ***
Comment 4 Lars Vogel CLA 2013-04-25 04:01:16 EDT
Thanks Dani for considering this. In my experience in training other Java developers I noticed that must are not aware of the templates, I believe this will give the templates a much higher visibility. I will also blog about this potential feature.
Comment 5 Dani Megert CLA 2013-04-25 04:12:39 EDT
Can you attach that also shows the keywords?
Comment 6 Lars Vogel CLA 2013-04-25 04:20:07 EDT
Dani, I'm not sure what you mean with keywords, the switch example from Bug 32971 works as described. 

Here is my blog post about the potential template feature: http://www.vogella.com/blog/2013/04/25/eclipse-papercut-12-showing-all-templates-in-code-completion/
Comment 7 Dani Megert CLA 2013-04-25 04:24:14 EDT
(In reply to comment #6)
> Dani, I'm not sure what you mean with keywords, the switch example from Bug
> 32971 works as described. 

Java keywords, e.g. 'private', 'final', etc.
Comment 8 Lars Vogel CLA 2013-04-25 04:29:37 EDT
AFAIK there is currently no code completion for Java keywords. I suggest to handle this via a separate bug.

I'm personally also currently sure if code completion for keywords would be desirable.
Comment 9 Lars Vogel CLA 2013-04-25 04:30:28 EDT
Typo: I'm personally also currently "NOT" sure if code completion for keywords would be desirable.
Comment 10 Lars Vogel CLA 2013-04-25 04:34:16 EDT
Just tested. "Java Non-Type Proposals" seems to be the "Java Keyword Proposals", I never activate that one before. 

Is the above statement correct?
Comment 11 Dani Megert CLA 2013-04-25 04:46:32 EDT
(In reply to comment #10)
> Just tested. "Java Non-Type Proposals" seems to be the "Java Keyword
> Proposals", I never activate that one before. 
> 
> Is the above statement correct?

Do you really think I mention the keyword proposals, if they are not there? ;-)

1. start Eclipse with new workspace
2. paste "class ShowKeywords {}" into 'Package Explorer'
3. inside the braces type p + Ctrl+Space
==> 'private', 'protected' and 'public' appear
Comment 12 Lars Vogel CLA 2013-04-25 04:51:28 EDT
"Java Non-Type Proposals" is not active by default, hence I missed that. Also I think the name is not very descriptive. Can I rename this option to "Java Keyword Proposals" in a patch or is there more behind this option?

I also see if I can implement the same behavior for Keywords as I did for Templates.
Comment 13 Dani Megert CLA 2013-04-25 05:02:27 EDT
(In reply to comment #12)
> "Java Non-Type Proposals" is not active by default, hence I missed that.
> Also I think the name is not very descriptive. Can I rename this option to
> "Java Keyword Proposals" in a patch or is there more behind this option?

No, this is the correct name.
Comment 14 Lars Vogel CLA 2013-04-25 05:49:12 EDT
Can I rename this option to
> > "Java Keyword Proposals" in a patch or is there more behind this option?
> 
> No, this is the correct name.

Thanks. Create patch and bug report for the renaming: Bug 406523
Comment 15 Dani Megert CLA 2013-04-25 05:51:19 EDT
(In reply to comment #14)
> Can I rename this option to
> > > "Java Keyword Proposals" in a patch or is there more behind this option?
> > 
> > No, this is the correct name.
> 
> Thanks. Create patch and bug report for the renaming: Bug 406523

The answer was "no". The current name is correct.
Comment 16 Lars Vogel CLA 2013-04-25 05:56:00 EDT
Sorry for my misunderstanding, answering "no" to an "or" question leaves room for interpretation. I interpreted the "no" to: "or is there more behind this option?". And I felt "this is the correct name." seems to me that the new name is the correct one.

Sorry again.
Comment 17 Dani Megert CLA 2013-04-25 06:02:51 EDT
(In reply to comment #16)
> Sorry for my misunderstanding,

Don't worry.


> answering "no" to an "or" question leaves
> room for interpretation.

Correct, but "The current name is correct." should have clarified the "no".
Comment 18 Dani Megert CLA 2013-04-25 06:58:35 EDT
Lars, please don't change the fields that I set. Thanks.

The keyword fix is in JDT Core. Filed bug 406530 with a patch for that.

Markus and I like the change where we show the templates and the keywords when there's no prefix.

Added an entry to the copyright notice and committed as http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=8784c4cedca248ed848edd5edd1d7c2f3a7741e4
Comment 19 Lars Vogel CLA 2013-04-25 07:04:39 EDT
Thanks Dani for the fast application of the fix, I also think this will make templates much more useful.

Just for clarification, I rarely change flags actively you set, I typically leave the bug report open in the browser. Looks like the browser does resend the flags if I write a new comment. This time I refreshed the browser before submitting, I hope your flags remain this time.
Comment 20 Lars Vogel CLA 2013-04-26 02:28:04 EDT
I suggest to add this to M7 Notes and Newsworthy.
Comment 21 Dani Megert CLA 2013-04-26 03:08:42 EDT
(In reply to comment #20)
> I suggest to add this to M7 Notes and Newsworthy.

OK. Can you make a patch for
http://git.eclipse.org/c/platform/eclipse.platform.news.git/tree/platform/4.3/M7/eclipse-news-M7.html
?
Comment 22 Lars Vogel CLA 2013-04-26 03:24:50 EDT
Created attachment 230149 [details]
Patch

Attached
Comment 23 Dani Megert CLA 2013-04-26 04:10:50 EDT
(In reply to comment #22)
> Created attachment 230149 [details] [diff]
> Patch
> 
> Attached

This patch deletes/corrupts the existing entry. Also, EGit cannot apply binary patches - you have to attach binary data to this bug.
Comment 24 Lars Vogel CLA 2013-04-26 04:34:32 EDT
Created attachment 230156 [details]
N&N patch

Updated patch for N&N
Comment 25 Lars Vogel CLA 2013-04-26 04:36:27 EDT
Created attachment 230157 [details]
Screensho

Screenshot not the best quality. Maybe you create one one Windows with a better resolution.
Comment 26 Dani Megert CLA 2013-04-26 07:18:29 EDT
(In reply to comment #24)
> Created attachment 230156 [details] [diff]
> N&N patch
> 
> Updated patch for N&N

Not sure what you're doing but you can easily see in your patch, that it removes existing content:

-     Ever encountered a case where content assist adds type parameters for a generic type, but you do not want them 
-     (example: while invoking a static method)? Now, rather than deleting them individually, 
-     you can just delete the '<' and that will remove the entire text up to '>'.
+	The usage of templates in JDT has been simplified. If you press CTRL+Space without a starting letter you see all templates instead of an empty list. The same is available for keyword completion.
+	<p><img src="images/templates.png" alt=""/></p>
+    </td>
+  </tr>
+
+  <tr id="improssed-template-handling">
+    <td class="title">Improved template handling</td>
+    <td class="content">
+
Comment 27 Lars Vogel CLA 2013-04-26 07:40:14 EDT
Created attachment 230170 [details]
N&N patch

Sorry, next try.
Comment 28 Dani Megert CLA 2013-04-26 07:51:10 EDT
Created attachment 230171 [details]
Conflicts

Could you please test your next patch before uploading, i.e. apply it via EGit to master? I'm going to loose my patience here.
Comment 29 Lars Vogel CLA 2013-04-26 07:56:03 EDT
Understandable that you loose your patience, I was using Git command line as I though it is overkill to setup Eclipse for this trivial change. Sorry that this created a lot of work on your side.

Asking for this trivial contribution via Git seemed to have created a lot of unnecessary work in this case on both our sides. Maybe you can paste the text directly into the file?


 <tr id="improved-template-handling">
    <td class="title">Improved template handling</td>
    <td class="content">
    The usage of templates in JDT has been simplified. If you press CTRL+Space without a starting letter you see all templates instead of an empty list. The same 
    functionality is available for keyword completion. 
	<p><img src="images/templates.png" alt=""/></p>
    </td>
  </tr>  

If that is not feasible I can setup Eclipse for this repo or we just skip this item in the N&N.
Comment 30 Dani Megert CLA 2013-04-26 08:22:49 EDT
(In reply to comment #29)
> Understandable that you loose your patience, I was using Git command line as
> I though it is overkill to setup Eclipse for this trivial change. Sorry that
> this created a lot of work on your side.
> 
> Asking for this trivial contribution via Git seemed to have created a lot of
> unnecessary work in this case on both our sides. Maybe you can paste the
> text directly into the file?
> 
> 
>  <tr id="improved-template-handling">
>     <td class="title">Improved template handling</td>
>     <td class="content">
>     The usage of templates in JDT has been simplified. If you press
> CTRL+Space without a starting letter you see all templates instead of an
> empty list. The same 
>     functionality is available for keyword completion. 
> 	<p><img src="images/templates.png" alt=""/></p>
>     </td>
>   </tr>  
> 
> If that is not feasible I can setup Eclipse for this repo or we just skip
> this item in the N&N.

(In reply to comment #28)
> Created attachment 230171 [details]
> Conflicts
> 
> Could you please test your next patch before uploading, i.e. apply it via
> EGit to master? I'm going to loose my patience here.

Eclipse does not (always) like git am patches, see bug 368358. After manually cutting away the non-patch related stuff, it applies, but I now, used different wording and image.
Comment 31 Lars Vogel CLA 2013-04-26 08:26:42 EDT
Thanks Dani