Bug 184604 - Patch for: Code completion for templates
Patch for: Code completion for templates
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Completion & Templates
6.x
PC Linux
: P3 with 4 votes (vote)
: 7.4
Assigned To: Dusan Balek
issues@editor
: PATCH_AVAILABLE
: 108180 129278 194734 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-21 12:15 UTC by Filip Zamboj
Modified: 2013-05-05 02:30 UTC (History)
6 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Proposed patch (5.41 KB, patch)
2013-01-30 23:01 UTC, markiewb
Details | Diff
Patch in action (73.57 KB, image/png)
2013-01-30 23:04 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Zamboj 2010-04-21 12:15:14 UTC
code completion for templates shouldn't use expanded text only but should use abbreviation as well.

example of template: 
1. 
abbreviation: myclass
expanded text: myclass { __construct() {} } 
code completion will now offer myclass from template when you type mycla(ctr+space)

2. 
as stated in BUG 183547 you "run into troubles" once you change expanded text on something else then myclass. 
abbreviation: myclass
expanded text: 
/**
 * @author PHP Super Trooper Coder 
 */
myclass { __construct() {} } 
you have no chance to get this in code completion
Comment 1 Vitezslav Stejskal 2010-05-18 10:21:27 UTC
Makes sense to me. Perhaps CC could offer any template containing the text typed in the editor and not just those that start with the text. A reasonable ordering of these suggestions would be neccessary of course. Or maybe these inexact templates might not be offered in the smart CC. Just random thoughts...
Comment 2 markiewb 2013-01-30 23:01:26 UTC
Created attachment 130859 [details]
Proposed patch

I like to propose a patch for this issue.

* completion now works with the abbreviation (as prefix) - as requested
* completion based on parameterized text has been removed (made no sense for me - see http://netbeans.org/bugzilla/show_bug.cgi?id=184604#c0 point 2.)
* no contexts are supported anymore (made no sense for me too)


@NetBeans-Devs: Please review, discuss and commit... Thank you
Comment 3 markiewb 2013-01-30 23:04:30 UTC
Created attachment 130860 [details]
Patch in action
Comment 4 markiewb 2013-01-31 08:27:17 UTC
*** Bug 194734 has been marked as a duplicate of this bug. ***
Comment 5 Dusan Balek 2013-01-31 13:54:51 UTC
Comments to the proposed patch:
- I'm not sure that using the template abbreviation as the code completion prefix is always better than the expanded text prefix (e.g. typing 'Sy(ctrl+space)' inside method body, code template 'System.out.println()' with abbreviation 'sout' would not be proposed)
- as for contexts - makes sense for me not to propose e.g. "protected void method()" outside of a class or inside of another method body.

Anyway, I think that the NB integration of code templates and code completion deserves a deeper redesign (currently planned for the next release hopefully).
Comment 6 markiewb 2013-03-03 23:19:19 UTC
*** Bug 108180 has been marked as a duplicate of this bug. ***
Comment 7 markiewb 2013-03-03 23:20:19 UTC
*** Bug 129278 has been marked as a duplicate of this bug. ***
Comment 8 markiewb 2013-03-03 23:20:53 UTC
*** Bug 167108 has been marked as a duplicate of this bug. ***
Comment 9 Dusan Balek 2013-05-03 06:39:19 UTC
Fixed in jet-main. Abbreviations should be used together with parameterized text prefix.

http://hg.netbeans.org/jet-main/rev/9cde477eea86
Comment 10 Quality Engineering 2013-05-05 02:30:19 UTC
Integrated into 'main-golden', will be available in build *201305042300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/9cde477eea86
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #184604: Code completion for templates should use abbreviations as well - fixed.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo