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 149844 - Code Completion for tag moves text to the right and does not replace it
Summary: Code Completion for tag moves text to the right and does not replace it
Status: RESOLVED WONTFIX
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-11 01:11 UTC by tonybeckham
Modified: 2015-09-17 13:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tonybeckham 2008-10-11 01:11:34 UTC
When invoking CC inside of an existing tag, the existing text is moved to the right.

System:
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)

Steps:
1. Paste the following code into an empty XML file

<?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>


2.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.

<import> becomes <import resource=""ort>
Comment 1 Samaresh Panda 2008-10-11 01:46:27 UTC
It'll be nice to have such a fix (if exists). However, Tony, this is not a bug for the following reasons:
a) It is hard to justify what needs to be replaced and what not
b) The user can counter argue and say that s/he didn't want to replace.
c) These are user's typed characters and we don't want to delete that.
d) The use-case will have several corner cases.

Think about it for a sec. Well, lets talk about java CC. If I have System.out.println("Hello"); and I invoke CC after
the second dot and choose something else, say "checkError()" it'll simply insert that and println will move to the right.

The fact that, it was user's text, we have to honor that.
Comment 2 tonybeckham 2008-10-11 03:37:29 UTC
"It'll be nice to have such a fix (if exists)."

OK, I agree with your point.  I'm just looking to improve the product, thus the 7.0 milestone and enhancement designation.
Comment 3 Svata Dedic 2012-05-28 13:41:24 UTC
To the contrary of Samaresh, I consider the behaviour a defect. At least the CC should understand that it is being invoked on a prefix of a tagname, so if a tagname is completed, it should replace not only the prefix, but whole original tagname. Also required attributes must not be blindly generated, but rather appended if not defined yet.
Comment 4 Martin Balin 2015-09-17 13:17:05 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.