Community
Participate
Working Groups
Assuming someone tries content-assist on an empty .java file, it would be nice to show templates such as "Create new class <fileName>", "Create new interface <fileName>", "Create new enum <fileName>"... that would scaffold a minimal content (packange and object declaration at least). Or maybe those completion items could directly open the right New wizard without leaving opportunity to change the name and let the wizard perform the change.
Note that if we go for templates rather than wizards, it would be also profitable to JDT-LS, while wizards wouldn't.
I tried out just a simple template and using the CompilationUnit to roughly fill in some values : https://rgrunber.fedorapeople.org/empty-java-template.ogv The problem with this being useful is all the other templates that show up for an empty .java file, not to mention the valid auto-completions for the file itself (eg. abstract, class, enum, etc.) Maybe the video makes it seem a bit worse than it is because most users wouldn't get the jni* templates (from org.eclipse.swt.tools) but one might still need to scroll down a bit or at least know to look for that template.
I like your proposal and the new template. However, I agree it would be best to show this template first in the list as the "most interesting" one a user would like to see on an empty file. I suggest to split this in 2 commits/tasks: 1. author the template and make sure they're available, then 2. try to make them first proposal.
(In reply to Mickael Istria from comment #3) > I like your proposal and the new template. However, I agree it would be best > to show this template first in the list as the "most interesting" one a user > would like to see on an empty file. > I suggest to split this in 2 commits/tasks: 1. author the template and make > sure they're available, then 2. try to make them first proposal. Yeah, sounds reasonable. The tricky part is that the first proposals (eg. abstract, class, enum, ..) are not templates but actual completions in the given context (cursor not inside any block statement). I could certainly see if there's a way to order templates, but not sure how to place a template even above non-template entries. The preference page seems to allow some kind of ordering. I'll have to look further.
New Gerrit change created: https://git.eclipse.org/r/116887
Gerrit change https://git.eclipse.org/r/116887 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=cf6c42522ee5a5ea21a34fcfdecf3504d4750a04
💕 Is it in any way reusable by JDT-LS ?
(In reply to Mickael Istria from comment #7) > 💕 > Is it in any way reusable by JDT-LS ? It relies on AbstractTemplateCompletionProposalComputer which implements IJavaCompletionProposalComputer, so not yet, but I believe it can be done.
Anything pending here or can it be closed for M1?
Just N&N entry, but I can close and open separate bugs on any new fixes to this.
Verified for 4.14 M1 using I20191009-0600 build.
New Gerrit change created: https://git.eclipse.org/r/150958
Gerrit change https://git.eclipse.org/r/150958 was merged to [master]. Commit: http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=c0d02d9297bea48870b7aa29f178e0f62736e6cd