summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Sandonato2012-08-10 15:18:30 (EDT)
committerNick Sandonato2012-09-12 11:14:33 (EDT)
commit50ec6e1e09c94d36e2ba88069cd6f0498ab28acf (patch)
tree63b240b46ce07da736be79fe3ea877815b759e5c
parent649e6275d91539e61ddd58aeb721c10c09e8c920 (diff)
downloadwebtools.sourceediting-50ec6e1e09c94d36e2ba88069cd6f0498ab28acf.zip
webtools.sourceediting-50ec6e1e09c94d36e2ba88069cd6f0498ab28acf.tar.gz
webtools.sourceediting-50ec6e1e09c94d36e2ba88069cd6f0498ab28acf.tar.bz2
[386974] On completing <script> attributes, source is wrong inserted and re-formatted
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLModelQueryCompletionProposalComputer.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLModelQueryCompletionProposalComputer.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLModelQueryCompletionProposalComputer.java
index 303104a..0db8a2a 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLModelQueryCompletionProposalComputer.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/AbstractXMLModelQueryCompletionProposalComputer.java
@@ -370,6 +370,14 @@ public abstract class AbstractXMLModelQueryCompletionProposalComputer extends Ab
}
if(defaultValue != null && ((matchString.length() == 0) || defaultValue.startsWith(matchString))) {
String rString = "\"" + defaultValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ final String regionText = contentAssistRequest.getDocumentRegion().getText(contentAssistRequest.getRegion());
+ final int matchStringLength = contentAssistRequest.getMatchString().length();
+ if (matchString.length() > 0 && matchStringLength < regionText.length()) {
+ final String remaining = regionText.substring(matchStringLength).trim();
+ if (remaining.charAt(0) != '\'' && remaining.charAt(0) != '"') {
+ rLength = matchStringLength;
+ }
+ }
CustomCompletionProposal proposal = new CustomCompletionProposal(
rString, rOffset, rLength, defaultValue.length() + 1,
XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_DEFAULT),