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 s4s-elt-must-match.2 #468

Merged
merged 1 commit into from
Jun 25, 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 @@ -34,6 +34,7 @@ public enum XSDErrorCode implements IXMLErrorCode {
p_props_correct_2_1("p-props-correct.2.1"),
s4s_elt_invalid_content_1("s4s-elt-invalid-content.1"), //
s4s_elt_must_match_1("s4s-elt-must-match.1"), //
s4s_elt_must_match_2("s4s-elt-must-match.2"),
s4s_att_must_appear("s4s-att-must-appear"), //
s4s_elt_invalid_content_2("s4s-elt-invalid-content.2"), //
s4s_att_not_allowed("s4s-att-not-allowed"), //
Expand Down Expand Up @@ -109,6 +110,7 @@ public static Range toLSPRange(XMLLocator location, XSDErrorCode code, Object[]
return XMLPositionUtility.selectAttributeFromGivenNameAt("minOccurs", offset, document);
case s4s_elt_invalid_content_1:
case s4s_elt_must_match_1:
case s4s_elt_must_match_2:
case s4s_att_must_appear:
case s4s_elt_invalid_content_2:
case src_element_2_1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ public void s4s_elt_character() throws BadLocationException {
testDiagnosticsFor(xml, d(3, 24, 3, 27, XSDErrorCode.s4s_elt_character));
}

@Test
public void s4s_elt_must_match_2() throws BadLocationException {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n" +
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\">\r\n" +
" <xs:simpleType name=\"X\"></xs:simpleType>\r\n" +
"</xs:schema>";
testDiagnosticsFor(xml, d(2, 2, 2, 15, XSDErrorCode.s4s_elt_must_match_2));
}

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