This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Custom Code Templates and Code Completion | ||
---|---|---|---|
Product: | editor | Reporter: | tog <tog> |
Component: | Completion & Templates | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | athompson, ceklock, edutrul, emi, jurib, markiewb |
Priority: | P2 | Keywords: | API, API_REVIEW_FAST |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 232287 | ||
Attachments: | Proposed SPI change |
Description
tog
2009-03-20 21:38:24 UTC
Thanks for your feedback! *** Issue 163428 has been marked as a duplicate of this issue. *** *** Issue 166441 has been marked as a duplicate of this issue. *** I want to switch from Eclipse to NetBeans as well, but I find it particularly difficult to learn that custom code templates require another key(combination) than code completion. Even if this seems negligible, it is quite a cognitive effort I have to take every time thinking on which function I have to use now, where before I just pressed the same keys for completion as well as templates. My suggestion is to be able to enhance the completion feature by including the defined code templates, giving a list of options when different possibilities are available. This would ease using (and switching to) NetBeans for Eclipse users to a really great extent. CodeTemplateCompletionProvider shows only those code templates in the code completion list that have their contexts specified. The contexts are unique identifiers used by the infrastructure (CodeTemplateFilters) to filter out code templates that are not suitable for the editor context, where a user types. The actual identifiers are defined by each particular language (mime type) and can be different for different languages. The language defines contexts for its constructs such as loops, methods, classes, if-else blocks, etc. and than tags each code template available for that language with a context, where it is meaningful to apply the template. To implement the customizer that allows for uses to specify the contexts for their custom code templates we need the infrastructure (CodeTemplateFilters) to specify all the possible context values valid for the given language (supported by the particular CodeTemplateFilter). To that purpose CodeTemplateFilter.ContextBasedFactory interface with the getSupportedContexts() method is proposed as an extension to the existing SPI. Created attachment 133919 [details]
Proposed SPI change
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/86f9686c1afc 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/86f9686c1afc User: Dusan Balek <dbalek@netbeans.org> Log: Issue #160771: Custom Code Templates and Code Completion - fixed. *** Bug 212176 has been marked as a duplicate of this bug. *** Very nice! The next logical step is to allow code templates with the same name so long as the contexts don't overlap. Created issue #232287. It is not working on netbeans 7.4 Product Version: NetBeans IDE 7.4 (Build 201310111528) Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 3 Java: 1.8.0_20; Java HotSpot(TM) Client VM 25.20-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 System: Linux version 3.2.0-67-generic-pae running on i386; UTF-8; en_US (nb) User directory: /home/edutrul/.netbeans/7.4 Cache directory: /home/edutrul/.cache/netbeans/7.4 I've got plenty of code templates but code completion is not working yet Do I have to aplly patch or sth like that ? Please help! thanks a lot best regards Have the code templates configured context? The code completion will not show then, when the context is left blank, (as stated in comment 5) How to configure context in order to support code completion for PHP ? It is not clear yet Thanks a lot! best regards (In reply to edutrul from comment #11) > It is not working on netbeans 7.4 > > Product Version: NetBeans IDE 7.4 (Build 201310111528) > Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 3 > Java: 1.8.0_20; Java HotSpot(TM) Client VM 25.20-b23 > Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 > System: Linux version 3.2.0-67-generic-pae running on i386; UTF-8; en_US (nb) > User directory: /home/edutrul/.netbeans/7.4 > Cache directory: /home/edutrul/.cache/netbeans/7.4 > > I've got plenty of code templates but code completion is not working yet > > Do I have to aplly patch or sth like that ? > > Please help! thanks a lot > best regards @edutrul: Please do not reopen issues from old versions (8.0 is the most recent stable). File an issue for the PHP component of NetBeans! Currently the PHP component does not implement the specific API (support of context), so you will never see your PHP templates. FYI: Set the state to Resolved Fixed - again. (In reply to markiewb from comment #14) > File an issue for the PHP component of NetBeans! See https://netbeans.org/bugzilla/show_bug.cgi?id=246664 |