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.

Bug 250321 - Show code templates in code completion for HTML/XHTML/XML files
Summary: Show code templates in code completion for HTML/XHTML/XML files
Status: CLOSED INVALID
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
: 260755 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-10 07:52 UTC by colerend
Modified: 2018-05-30 09:45 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description colerend 2015-02-10 07:52:06 UTC
Hi guys.

First off, thanks for making such a great IDE - I used to be an avid Eclipse user but these days I truly enjoy sitting down infront of NetBeans, good job!

Let's get down to it, I am filing this under "enhancement", but what I'm hoping to get out of this ticket is really the information to "enhance" the IDE myself, because the one thing I have a gripe with when I code in NetBeans is the way its code completion works. I feel convinced that the "behavior" must somehow be modifiable, but I am unable to find anything about my exact issues in the settings - so I am hoping it's doable by editing some config file...

Here's the thing, let's say I am coding an HTML-page, have my template ready and want to enter a new <span> element... so, I write:

<span

and hit Ctrl+Space to get the code completion up, and sure enough a "<span>" appears in the code-completion.

Now... what I want to do, is modify the "code template" that effectively decides what happens when I select a code-completion element to insert. Right now, in the above usecase, all I get back is the same "<span"-entry I had already written - doesn't make much sense to me... For me, a much better result would be something like the following code-template:

<span>${content}</span>${cursor}

I'd likewise be able to customize several other "small parts" of the code-completion, not just for HTML but also for JavaScript. 

I am aware of the code-template feature, and yes I can get the above behaviour using that. But I am so used to always handle my completion with Ctrl+space, and I really see no reason why I shouldn't be able to customize that behavior aswell. Please tell me there is a way to do this...

Thanks

Regards,
Cole
Comment 1 Christian Lenz 2016-10-14 07:48:51 UTC
In JS files, it is supported since NetBeans 8.2. HTML is still missing :/
Comment 2 Christian Lenz 2016-10-14 07:50:07 UTC
*** Bug 260755 has been marked as a duplicate of this bug. ***
Comment 3 colerend 2016-10-21 05:19:05 UTC
(In reply to ChrisLE from comment #1)
> In JS files, it is supported since NetBeans 8.2. HTML is still missing :/

If this is supported in the JS editor - how do I actually alter the code-completion for JavaScript? 

I don't really have much need for this, because the JS support is damn near spot on, but for my own curiosity how would it be done?

Also, I'm a little amazed nothing new has happened on this topic. Using code-completion in HTML-editor, and selecting for example "<span>" from the popup, still leaves me hanging with an ugly- and incomplete "<span" to continue with.

Surely this behavior must be modifiable ?
Comment 4 Christian Lenz 2016-10-21 12:05:59 UTC
Thix ticket is not for altering the code completion for JS. If you want so, please ask in the forum or have a look here: https://netbeans.org/community/lists/top.html#dev

if you want to add such functionality for HTML/XHML/XML to the NB core, please have a look in this ticket, how Petr Pisl did this: https://netbeans.org/bugzilla/show_bug.cgi?id=259167
Comment 5 Christian Lenz 2016-10-21 12:10:31 UTC
So the altering of JS code completion is a really other topic than this. I would prefer to change this ticket to DEFECT instead of ENHANCEMENT(?)
Comment 6 Christian Lenz 2017-01-29 22:08:36 UTC
Maybe the context is missing for HTML code templates. I have a plugin and HTML-Code is not working. Can someone give me the right context? I hope that there is a context, like in PHP and JavaScript. It is php-code and JavaScript-code.
Comment 7 Christian Lenz 2017-07-26 21:39:08 UTC
Anything new here?
Comment 8 Christian Lenz 2017-10-17 19:24:16 UTC
We need a consistency to all languages. You can set the context of PHP and JS, I think for Java too, so wee need to set this for HTML too. Otherwise, plugins which add code template are not working. Ok they will work, but a template like this: a-ngFor-trackBy is not easy to know.
Comment 9 Christian Lenz 2017-10-17 21:28:26 UTC
I created the ticket at Apache Jira now: https://issues.apache.org/jira/browse/NETBEANS-95

if there is no other objection, I will close this ticket here, because it is already referenced in the other ticket.
Comment 10 Christian Lenz 2018-05-30 09:43:30 UTC
As mentioned before, I created a ticket in the Apache Jira board.