Bug 219992 - [content assist] Incorrect insertion of value with help of content assist in some case
Summary: [content assist] Incorrect insertion of value with help of content assist in ...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.html (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.4.1   Edit
Assignee: Salvador Zalapa CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2008-02-22 12:03 EST by Andrei Scherbovich CLA
Modified: 2012-08-10 16:41 EDT (History)
2 users (show)

See Also:
nsand.dev: review+


Attachments
Initial patch (1.61 KB, patch)
2012-06-06 23:13 EDT, Salvador Zalapa CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Scherbovich CLA 2008-02-22 12:03:17 EST
Build ID:  M20070921-1145

Steps To Reproduce:
EXECUTE: Create test.html:
<html dir=  lang="" >
</html>
EXCUTE: Ctrl+Space at <html dir= |
EXCUTE: Choose "ltr". Enter.
FAILURE: We got <html dir= "ltr""" >

More information:
Comment 1 Nitin Dahyabhai CLA 2008-02-25 22:50:02 EST
Not sure there's much that can be done here.  The presence of the first '=' combined with lack of an attribute value makes the "lang" attribute name be interpreted as the value of the "dir" attribute.
Comment 2 Ian Tewksbury CLA 2010-02-01 16:11:37 EST
I think a solution can be found here because invoking content assist at
<html dir=|  lang="" >
results in:
<html dir="ltr"  lang="" >

while
<html dir= | lang="" >
results in
<html dir=  "ltr""" >


Thus whatever is being done for the first case should be done for the second case, most likely having to do with some trickery of the location of the cursor and the = that could be expanded to include whites pace after the =.
Comment 3 Salvador Zalapa CLA 2012-06-06 23:13:28 EDT
Created attachment 216991 [details]
Initial patch
Comment 4 Salvador Zalapa CLA 2012-06-06 23:13:57 EDT
Attaching an initial proposed patch. It consist in skiping the replacement of the region, when the offset is not at the beginning of the region, only when the region is XML_TAG_ATTRIBUTE_EQUALS.

Example:  <html dir= | lang="" >
result:   <html dir= "ltr" lang="" >

I already run the following junits with successful results:
org.eclipse.wst.xml.ui.tests
org.eclipse.wst.html.ui.tests
org.eclipse.wst.css.ui.tests
Comment 5 Nick Sandonato CLA 2012-06-07 16:21:04 EDT
Hi, Chava. Thanks for taking a look at this.

Another scenario that I just tried was
<html dir= |lang="en">

and this caused the lang= to be consumed similar to the other scenario. Would it be possible to correct that as well?
Comment 6 Salvador Zalapa CLA 2012-06-12 10:46:46 EDT
Hello Nick:
On that particular scenario the completionRegion is recognized as XML_TAG_ATTRIBUTE_VALUE, that is why in AbstractXMLCompletionProposalComputer.computeAttributeValueProposals, the setup is to replace the existing value ( in this case lang=). As Nitin says in comment #2, so far i think there is no much we can do.
Comment 7 Nick Sandonato CLA 2012-06-12 10:48:24 EDT
Understood and I agree. Thanks, Chava.
Comment 8 Nick Sandonato CLA 2012-08-10 16:38:38 EDT
Changes pushed.
Comment 9 Nick Sandonato CLA 2012-08-10 16:39:08 EDT
.