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 171586

Summary: SourceCache bug? [was:composite:facet and composite:insertFacet
Product: editor Reporter: edburns <edburns>
Component: Parsing & IndexingAssignee: Tomas Zezula <tzezula>
Status: RESOLVED WONTFIX    
Severity: blocker CC: ethermion, mfukala, pjiricka, sdedic
Priority: P3    
Version: 6.x   
Hardware: Macintosh   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description edburns 2009-09-07 03:27:14 UTC
When building a composite component, it's possible to declare, in the interface section, that the component supports a facet, like this:

<cc:interface>
  <cc:facet name="header" />
</cc:interface>

Then,in the impl section, you use the facet, like this:

<cc:implementation>
  <cc:insertFacet name="header" />  
</cc:implementation>

or like this:

<cc:implementation>
  <cc:renderFacet name="header" />  
</cc:implementation>

It would be really nice if autocomplete for the "name" attribute gave me a list of declared facets to choose from.

In the using page, it would be nice to have the same autocompletion when using the component and you come to the <f:facet name=""> choice.
Comment 1 Marek Fukala 2009-10-22 12:51:35 UTC
That is a pity that the issue used to be hidden in the wrong category. I am affraid I am not allowed to implement any
features to 6.8 now. It sounds like useful feature anyway.
Comment 2 ethermion 2012-06-07 00:05:22 UTC
Well, it is probably too late for 7.2, but this would be a very nice enhancement.  Seems to have been *lost* again.  It would be awfully useful for those serious developers building composite component jar libraries.
Comment 3 Marek Fukala 2012-06-08 14:54:57 UTC
What Ed describes is supposed to work.
Comment 4 Marek Fukala 2012-06-11 10:46:57 UTC
fixed in web-main#5bed2d595dc7
Comment 5 edburns 2012-06-11 16:58:27 UTC
Thanks!
Comment 6 ethermion 2012-06-14 13:20:54 UTC
Against Build 201206140001

Not quite there.
When you first type:
<f:facet name=""

and your cursor is inside the quotes for name, ctrl-space gives a menu of attributes of the tag - name, id, parent, rendered etc.

If you cursor out of the quotes, then back in, then ctrl-space, it works.

Would also be double great if the displayName and shortDescription attributes of the facet showed up.
Comment 7 ethermion 2012-06-14 13:24:08 UTC
Again Build 201206140001

ctrl-space in facet name inside h:dataTable shows facet names from my custom component.  It does not show facet names from h:dataTable.
Comment 8 Marek Fukala 2012-06-15 08:10:45 UTC
> Not quite there.
> When you first type:
> <f:facet name=""
> 
> and your cursor is inside the quotes for name, ctrl-space gives a menu of
> attributes of the tag - name, id, parent, rendered etc.
Works fine for me all the time.

Any special steps to reproduce? Does it happen always for you?
Comment 9 Marek Fukala 2012-06-15 08:11:27 UTC
> ctrl-space in facet name inside h:dataTable shows facet names from my custom
> component.  It does not show facet names from h:dataTable.

Can you please put here a sample? What I did so far is the Ed's case only.
Comment 10 Marek Fukala 2012-06-15 08:20:56 UTC
(In reply to comment #8)
> > Not quite there.
> > When you first type:
> > <f:facet name=""
> > 
> > and your cursor is inside the quotes for name, ctrl-space gives a menu of
> > attributes of the tag - name, id, parent, rendered etc.
> Works fine for me all the time.
> 
> Any special steps to reproduce? Does it happen always for you?

Actually I managed to reproduce it. The steps are:

1) put <f:facet | into a facelets document
2) invoke completion
3) complete "name"
4) !!! wait until the file gets parsed before continue !!!
5) invoke completion in the name="|" position
=> tag attributes are offered

if one doesn't fulfill the #4 condition it works well.

Seems to be caused by an incorrect parse tree.
Comment 11 Marek Fukala 2012-06-15 10:39:04 UTC
It looks like some issue in the parsing.api resp. in the SourceCache.

The HtmlCompletionProvider runs an UserTask, then gets parser result by resultIterator.getParserResult(offset)

However the returned parser result is not always the fresh one, sometimes an older result along with snapshot is returned:

1) typed <f:facet | :
XhtmlElEmbeddingProvider.getEmbeddings() - created snapshot: Snapshot 27467691: newjsf1.xhtml( text/html 0-516)

2) invoked cc and completed "name" :
completion got snapshot Snapshot 27467691: newjsf1.xhtml( text/html 0-516)
XhtmlElEmbeddingProvider.getEmbeddings() - created snapshot: Snapshot 25011966: 

3) invoked cc in the name="|" :
completion got snapshot Snapshot 27467691: newjsf1.xhtml( text/html 0-516)
completion got snapshot Snapshot 27467691: newjsf1.xhtml( text/html 0-516)

=> the older parser result/snapshot is still used so the completion sees a whitespace only (the state where there's just "<f:facet  " text) and offers the attributes then.

This doesn't seem to be always reproducible, but happens quite often when using the steps from my comment above.

I remember Svate has been trying to solve some issue with code folding where there were similar symptoms. Is that true Svato?
Comment 12 Svata Dedic 2012-10-22 09:37:46 UTC
A potential duplicate is the issue #212014
Comment 13 Martin Balin 2016-07-07 07:32:06 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss