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 125975 - Code Completion replaces opening tag
Summary: Code Completion replaces opening tag
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords:
: 129646 (view as bug list)
Depends on:
Blocks: 138486
  Show dependency tree
 
Reported: 2008-01-25 06:16 UTC by tonybeckham
Modified: 2008-10-11 01:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
before code completion (15.19 KB, image/png)
2008-01-25 06:18 UTC, tonybeckham
Details
after code completion suggestion is chosen (14.88 KB, image/png)
2008-01-25 06:19 UTC, tonybeckham
Details
pre completion state (21.84 KB, image/png)
2008-06-19 12:00 UTC, Rohan Ranade
Details
post completion state (16.83 KB, image/png)
2008-06-19 12:01 UTC, Rohan Ranade
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tonybeckham 2008-01-25 06:16:46 UTC
Problem:
If a tag already exists and code completion has a suggestion, the original tag is replaced with invalid syntax

Steps:
1. Create a new XML document
2. Replace all code with this:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    <!-- 
	  Exposes web flows for execution at a single request URL.
	  The id of a flow to launch should be passed in by clients using
	  the "_flowId" request parameter:
	      e.g. /phonebook.htm?_flowId=search
	-->
    <bean name="/phonebook.htm" class="org.springframework.webflow.executor.mvc.FlowController">
        <property name="flowExecutor" ref="flowExecutor"/>
    </bean>
    
    <!-- Resolves flow view names to .jsp templates -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    
</beans>

3. Place cursor after "<pr" in one of the properties tags
4. accept code completion of "properties"
5. XML syntax is broken
Comment 1 tonybeckham 2008-01-25 06:18:27 UTC
Created attachment 55547 [details]
before code completion
Comment 2 tonybeckham 2008-01-25 06:19:25 UTC
Created attachment 55548 [details]
after code completion suggestion is chosen
Comment 3 Samaresh Panda 2008-05-27 20:03:57 UTC
Fixed: http://hg.netbeans.org/main/rev/02899427ad41
Comment 4 Samaresh Panda 2008-05-27 21:17:15 UTC
*** Issue 129646 has been marked as a duplicate of this issue. ***
Comment 5 tonybeckham 2008-05-28 19:08:55 UTC
Fix Verified:

Product Version: NetBeans IDE Dev (Build 200805280004)
Java: 1.6.0_05; Java HotSpot(TM) 64-Bit Server VM 1.6.0_05-b13-52
System: Mac OS X version 10.5.2 running on x86_64; MacRoman; en_US (nb)
Comment 6 Rohan Ranade 2008-06-19 11:57:55 UTC
I can still reproduce the issue consistently (yesterday's nightly build). Type the following in a new Spring XML
Configuration file and place the cursor at location denoted by |:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    <bean name="main" class="javaapplication18.Main" init-method="" p:me-ref="sam" p:me="">
        <property name="me.me.me"/>
    </bean>
    |
    <import resource="sample/sam.xml"></import>


    <bean id="sam" abstract="true" autowire-candidate=""></bean>
</beans>

Insert an <import> tag and take the cursor over the tag as : <imp|ort 
Press CTRL+SPACE, the import tag is shown as a completion item. Please refer attachments to see pre and post completion
editor state.

I observe that this does not happen if the file has been saved after adding the <import> tag.

Product Version         = NetBeans IDE Dev (Build 080618)
  Operating System        = Linux version 2.6.24-18-generic running on i386
  Java; VM; Vendor        = 1.5.0_15; Java HotSpot(TM) Client VM 1.5.0_15-b04; Sun Microsystems Inc.
  Runtime                 = Java(TM) 2 Runtime Environment, Standard Edition 1.5.0_15-b04
  Java Home               = /home/rohanranade/jdk1.5.0_15/jre
Comment 7 Rohan Ranade 2008-06-19 12:00:07 UTC
Created attachment 63083 [details]
pre completion state
Comment 8 Rohan Ranade 2008-06-19 12:01:33 UTC
Created attachment 63085 [details]
post completion state
Comment 9 tonybeckham 2008-06-19 18:48:59 UTC
I see same behavior, thank you for reopening.  This was working but now it is not again.
Comment 10 Samaresh Panda 2008-09-09 18:35:54 UTC
Fixed: http://hg.netbeans.org/main?cmd=changeset;node=7aa3515ca5ae.
Do note that completion gets inserted at the offset and all other texts will move to the right after completion.
Comment 11 Quality Engineering 2008-09-10 06:01:22 UTC
Integrated into 'main-golden', will be available in build *200809100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7aa3515ca5ae
User: samaresh@netbeans.org
Log: #125975 Code Completion replaces opening tag
Comment 12 tonybeckham 2008-10-10 22:10:15 UTC
Still has same behavior as desc7. 

Product Version: NetBeans IDE Dev (Build 200810080201)
Java: 1.6.0_07; Java HotSpot(TM) 64-Bit Server VM 1.6.0_07-b06-57
System: Mac OS X version 10.5.5 running on x86_64; MacRoman; en_US (nb)
Comment 13 Samaresh Panda 2008-10-10 23:17:07 UTC
Tony, what is broken here? In my fix I said that the remainder text will move to the right. Please explain what is
broken? Also why do you think this is a P2 now?
Comment 14 tonybeckham 2008-10-11 01:01:17 UTC
The steps from rohanranade in desc7 remain an issue.  In my opinion this should be fixed. I agree that XML structure is
not broken so this issue can be closed.  However, I will create a new issue with regard to desc 7 and make it P3 for now
but I think it should be a p2 for Netbeans.next.
Comment 15 tonybeckham 2008-10-11 01:02:23 UTC
Original issue fixed
CC does not replace opening tag

Product Version: NetBeans IDE Dev (Build 200810080201)
Java: 1.6.0_07; Java HotSpot(TM) 64-Bit Server VM 1.6.0_07-b06-57
System: Mac OS X version 10.5.5 running on x86_64; MacRoman; en_US (nb)