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 112500 - DTD based code XML completion not working properly.
Summary: DTD based code XML completion not working properly.
Status: VERIFIED DUPLICATE of bug 140511
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords: REGRESSION
Depends on:
Blocks: 138486
  Show dependency tree
 
Reported: 2007-08-09 19:44 UTC by davisn
Modified: 2008-08-05 18:59 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
completion on struts config (128.60 KB, application/octet-stream)
2007-08-22 22:41 UTC, Samaresh Panda
Details
completion on sun-ejb-jar (105.85 KB, application/octet-stream)
2007-08-22 22:42 UTC, Samaresh Panda
Details
Screenshot showing broken code completion. (118.44 KB, image/png)
2007-08-23 00:29 UTC, _ pcw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description davisn 2007-08-09 19:44:41 UTC
After enter <debugging-enabled> element in sun-ejb-jar.xml file, the code tip completion does not appears for other 
<webservice-endpoint> sub-elements

STEPS TO REPRODUCE:
1. Install nightly netbean 6.0 - build dated 08/08/2007
2. Create a j2EE 1.4 EJB Module project
3. Open sun-ejb-jar.xml file > click EJB tab > click Add Ejb > click Web Services Endpoints > Add Endpoint 
4. Change sun-ejb-jar.xml file to XML format and enter
     <debugging-enabled>true</debugging-enabled>
   below the <port-component-name>endpoint1</port-component-name> statement
5. Enter < after <debugging-enabled> element
BUG:
   Code tip completion for other elements such as endpoint-address, login-config, message-security,... do not appear
Comment 1 _ pcw 2007-08-10 02:34:34 UTC
Yes, code completion isn't working with the new XmlMultiviewDataObject for sun-???.xml files.  On my list to fix...
Comment 2 _ pcw 2007-08-18 02:00:38 UTC
Interesting.  I originally assumed this was a sun appsrv plugin issue, but it's not.

Code completion is not working for web.xml (servlet 2.3 - uses DTD based completion), struts-config.xml (all versions
use DTD based completion), and tile-defs.xml (also structs, DTD based completion).

It looks like DTD based XML code completion has been broken globally.

Steps:

1. Open an XML file that uses DTD based completion in the editor (sun-???.xml, web.xml for Servlet 2.3 only, any struts
xml files.  See DTD/Schema registry in IDE for more of them.)
2. Insert a blank line after the root node, type "<" and hit ctrl-space.  You'll get a popup that says "No suggestions".
 You _should_ have gotten a popup with a list of all available tags.

Observations:
A.) Hitting ctrl-space in the middle of a valid tag appears to work.  Not that it matters since the tag is complete and
valid - who cares.  But it's interesting that it works.
B.) I discovered while typing this report that if you do steps (1) and (2) above in succession, it doesn't work.  BUT if
you do steps (1) and (2), then task switch to Firefox to edit this issue report, then task switch back to NetBeans and
immediately type ctrl-space, it DOES work.  To break it again, backspace to delete the "<", enter the "<" again, then
type ctrl-space and it'll be broken.

That suggests to me there may be a race condition or a contested lock that gets freed up "while away", so to speak.  Or
maybe the lookup call for code completion is taking too long and I'm too impatient (but I have waited 15-20 seconds at
the popups and seen nothing happen.)

Raising priority to P2, changed summary, and moving to XML module.
Comment 3 Samaresh Panda 2007-08-22 22:40:57 UTC
Works for me. See attached pictures.
Comment 4 Samaresh Panda 2007-08-22 22:41:29 UTC
Created attachment 47113 [details]
completion on struts config
Comment 5 Samaresh Panda 2007-08-22 22:42:14 UTC
Created attachment 47114 [details]
completion on sun-ejb-jar
Comment 6 Samaresh Panda 2007-08-22 22:43:36 UTC
If you think, it doesn't work, please attach the project you're having problem with.
Comment 7 _ pcw 2007-08-23 00:28:24 UTC
Just create a web project using glassfish as a server and select the struts web frameworks.  sun-web.xml and the structs
xml files all use DTD based code completion and any of them can be used to demonstrate this.

Suppose you open sun-web.xml and put the cursor on the line after <sun-web-app>, and the beginning.

A) If you type "<" and WAIT, code completion will appear automatically (because auto-popup completion defaults to true)
and it appears to be correct.

However, I'm impatient and the 1+ seconds it takes for the IDE to show completion is too long so...

B) Type "<" as above, and don't wait, immediately type Ctrl-Space to invoke completion.  You will get "No suggestions",
as shown in the attached screenshot, below.

C) Once you've gotten the "No suggestions" result, typing Ctrl-Space again will give the same result each time - "No
suggestions".  To get past this, you must hit Escape, and then hit Ctrl-Space.
Comment 8 _ pcw 2007-08-23 00:29:37 UTC
Created attachment 47117 [details]
Screenshot showing broken code completion.
Comment 9 Samaresh Panda 2007-08-23 00:48:27 UTC
To me this is not a bug. Your usage of CC is incorrect.
Comment 10 _ pcw 2007-08-23 01:48:38 UTC
Please explain which "Ctrl-space fails to bring up correct code completion" isn't a bug.

The point of code completion is to speed things up.  Here we are slowing them down.  And you are telling me this is by
design?  Why?

If the list is not ready yet (How can this be?  Java code completion is faster, yet it's far more complex.), put up a
"looking..." display and then fill in the list when it's ready.
Comment 11 apolenur 2007-10-07 20:18:28 UTC
I just switched from 5.5 to 6.0. And this issue forced me to switched back.

In 5.5 I could open existing XML document like Ant build.xml navigate to element and press Ctrl-Space to see what other
attributes available.

Typing "Space" does not work in this scenario since I don't really want to edit a doc. I just want to see what
attributes are supported by DTD or Schema.

This is really important feature since I can use it as a "reference/help" to create DTD or Schema defined XMLs. I used
it for Ant, Hibernate, JDO etc. 

It just does not work in 6.0. pressing Ctrl-Space always shows "No suggestions". 
At least after reading comments to this bug I know that I have to hit "Escape" and then space to see completion again.
Before that I was just stuck and frustrated 

I cannot see how come it is not a bug. For what ever it worth I think it is a bug and regression from 5.5.

We got to get Ctrl-Space working again. There is no way user like me who is switching from 5.5 will be able to figure
out that "it is by design" and I " just to have to wait until list pops up"

Thanks, Alexi
Comment 12 raharsha 2007-11-16 19:39:05 UTC
I too faced this issue. I was able to narrow it down to this. The problem is faced only if we type something between the
start and the end element. For eg, 

<ejb-name></ejb-name> works well and after it completes, you can insert the name in between the elements. 

If you do 

<ejb-name>MyEJB<   , the completion does not work.

There is some problem with the search being done. It is also very slow.
Comment 13 tonybeckham 2007-11-16 20:20:21 UTC
I understand that waiting may be confusing, but using RC2 on my MacBook Pro I don't have any delay in the code
completion suggestions following any of the steps to reproduced described in this issue.  I *DO* agree, that if there is
some amount of time (>.5 sec or something) then a loading message would be nice in order to prevent an early manual
invocation via ctrl-space.  I also agree that pressing ctrl-space before any suggestions occur is an improper use of CC
and I think that is what Sam was trying to say.  Addressing the issue of attribute completion, you simply need to insert
a space after the original CC tag insertion then invoke code completion.
example: 
1. in an xml schema, begin a tag "<" 
2. select xsd:element from suggestions "<xsd:element" is created
3. press space then invoke CC via ctrl-space to get list of attributes

My System Info:
Product Version: NetBeans IDE 6.0 RC1 (Build 200711160000)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.1 running on i386; MacRoman; en_US (nb)

2gb ram
Comment 14 _ pcw 2007-11-16 21:59:46 UTC
See http://editor.netbeans.org/doc/UserView/completion.html in particular

    ...
    The following keystrokes control the code completion:
        * CTRL+SPACE - popup the code completion box. ...

The following editors work as expected in this regard:

Java and Ruby editors, JSP editor, and even the XML editor when the document is based on schema.

It's only XML editors for DTD based documents that have this problem.

This also worked correctly (for DTD based XML documents) in NetBeans 5.5.1.

Please stop saying it's not a bug.  It's a bug and it should be fixed.
Comment 15 Erno Mononen 2007-11-22 14:52:49 UTC
I also ran into this issue. I have to second Peter here, I really can't see how in the world using ctrl-space for CC 
could be considered to be improper usage.
Comment 16 Samaresh Panda 2008-01-15 19:07:14 UTC
I'm saying that, hitting ctrl+space while waiting for the pop-up is a wrong usage. I didn't realize that a "Please wait"
message is missing here. I'll work on it and fix it.
Comment 17 Samaresh Panda 2008-08-04 23:04:11 UTC
Fixed. See issue 140511.

*** This issue has been marked as a duplicate of 140511 ***
Comment 18 tonybeckham 2008-08-05 18:59:24 UTC
Resolved and fixed.  Verified in:

Product Version: NetBeans IDE 6.5 Beta (Build 200808051501)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.4 running on i386; MacRoman; en_US (nb)