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 22291 - Code completion of "</" should directly insert the end tag
Summary: Code completion of "</" should directly insert the end tag
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Text-Edit (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: _ pkuzel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-10 14:58 UTC by Asgeir Asgeirsson
Modified: 2007-11-09 15:12 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
org.netbeans.modules.xml.text.completion.XMLCompletionQuery after changing v1.10 (31.48 KB, patch)
2002-04-10 15:02 UTC, Asgeir Asgeirsson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Asgeir Asgeirsson 2002-04-10 14:58:31 UTC
When writing "</" the completion popup window suggests the 
apropreate closing tag.  To insert the closing tag I have 
to press enter.  

When someone writes "</" in XML, he is defenetely closing 
an open tag.  The tag should thus be inserted 
automatically without requireing the user to press enter.

Most XML editors I know of do it that way, and I think 
this editor should do this too.

Following changes in the 
org.netbeans.modules.xml.text.completion.XMLCompletionQuery
 class will fix this:

In the 
query(JTextComponent component, int offset, SyntaxSupport 
support)
method the following line:

                    return null;  //??? end tag handling

should be replaced by:

                    if (preText.endsWith("</") && 
token.getTokenID().getNumericID() == 
XMLDefaultTokenContext.TEXT_ID) {
                        list = findStartTag((SyntaxNode)
element);
                        if (list != null && list.size() == 
1) {
                            ElementResultItem item = 
(ElementResultItem)list.get(0);
                            item.substituteText(component, 
offset, 0, 0);
                        }
                    }
                    return null;  //??? end tag handling

And in the 
query(SyntaxNode element, TokenItem token, String text)
method the following lines should be commented out:

                } else if ( text.endsWith("</" )) {
                    return findStartTag((SyntaxNode)
element);

I will attach the the changed file.  The changes can be 
better viewed by diffing it to version 1.10.
Comment 1 Asgeir Asgeirsson 2002-04-10 15:02:15 UTC
Created attachment 5357 [details]
org.netbeans.modules.xml.text.completion.XMLCompletionQuery after changing v1.10
Comment 2 _ pkuzel 2002-04-10 15:48:51 UTC
Nice enhancement!

Thank you, I have applied it

PS: why do not use "cvs di" next time?
Comment 3 Mikhail Matveev 2007-11-09 15:12:01 UTC
Verified