Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error range for sch-props-correct.2 #474

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum XSDErrorCode implements IXMLErrorCode {
s4s_att_not_allowed("s4s-att-not-allowed"), //
s4s_att_invalid_value("s4s-att-invalid-value"), //
s4s_elt_character("s4s-elt-character"), //
sch_props_correct_2("sch-props-correct.2"),
src_ct_1("src-ct.1"),
src_element_3("src-element.3"),
src_resolve_4_2("src-resolve.4.2"), //
Expand Down Expand Up @@ -128,7 +129,12 @@ public static Range toLSPRange(XMLLocator location, XSDErrorCode code, Object[]
}
case s4s_elt_character:
return XMLPositionUtility.selectContent(offset, document);
case src_ct_1:
case sch_props_correct_2: {
String argument = (String) arguments[0];
String attrName = argument.substring(argument.indexOf(",") + 1);
return XMLPositionUtility.selectAttributeValueFromGivenValue(attrName, offset, document);
}
case src_ct_1:
return XMLPositionUtility.selectAttributeValueAt("base", offset, document);
case src_resolve_4_2: {
String attrValue = (String) arguments[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ public void s4s_att_invalid_value() throws BadLocationException {
d(3, 2, 3, 12, XSDErrorCode.s4s_att_must_appear));
}

@Test
public void sch_props_correct_2() throws BadLocationException {
String xml = "<?xml version=\"1.1\" ?>\r\n" +
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\r\n" +
" <xs:element name=\"elt1\" />\r\n" +
" <xs:element name=\"elt1\" />\r\n" +
"</xs:schema>";
testDiagnosticsFor(xml, d(3, 18, 3, 24, XSDErrorCode.sch_props_correct_2));
}

@Test
public void src_ct_1() throws BadLocationException {
String xml = "<?xml version=\"1.1\" ?>\r\n" +
Expand Down