Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yann Cébron
2013-12-02 10:06:50 +01:00
5 changed files with 23 additions and 5 deletions
@@ -677,6 +677,10 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase {
myFixture.testCompletionVariants("Substitute/test.xml", "b:instance", "instance");
}
public void testAfterPrefix() throws Exception {
myFixture.testCompletion("Substitute/testAfterPrefix.xml", "Substitute/testAfterPrefix_after.xml", "Substitute/schema-a.xsd", "Substitute/schema-b.xsd");
}
public void testEnumeratedTagValue() throws Exception {
myFixture.configureByFile("tagValue/enumerated.xsd");
myFixture.testCompletionVariants("tagValue/completeEnum.xml", "none", "standard");
@@ -0,0 +1,7 @@
<root xmlns="http://test/a"
xmlns:b="http://test/b"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test/b schema-b.xsd">
<b:in<caret>
</root>
@@ -0,0 +1,7 @@
<root xmlns="http://test/a"
xmlns:b="http://test/b"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test/b schema-b.xsd">
<b:instance id=""
</root>
@@ -117,9 +117,7 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
}
public TextRange getRangeInElement() {
return myElement instanceof XmlAttributeValue
? ((XmlAttributeValue)myElement).getValueTextRange()
: new TextRange(1,myElement.getTextLength()-1);
return new TextRange(1,myElement.getTextLength()-1);
}
@Nullable
@@ -44,7 +44,7 @@ public class TagNameVariantCollector {
@Nullable List<String> nsInfo) {
XmlElementDescriptor elementDescriptor = null;
String elementNamespace = null;
String elementNamespace = element.getNamespacePrefix().isEmpty() ? null : element.getNamespace();
final Map<String, XmlElementDescriptor> descriptorsMap = new HashMap<String, XmlElementDescriptor>();
PsiElement context = element.getParent();
@@ -62,7 +62,9 @@ public class TagNameVariantCollector {
descriptorsMap.put(namespace, descriptor);
if(elementDescriptor == null) {
elementDescriptor = descriptor;
elementNamespace = namespace;
if (elementNamespace == null) {
elementNamespace = namespace;
}
}
}
}