From 552b2bcd84ce3303c371702412e1ed9861ce5040 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Tue, 25 Jun 2019 10:19:25 -0400 Subject: [PATCH] Fix error range for s4s-elt-must-match.2 Signed-off-by: David Kwon --- .../extensions/xsd/participants/XSDErrorCode.java | 2 ++ .../extensions/xsd/XSDValidationExtensionsTest.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsd/participants/XSDErrorCode.java b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsd/participants/XSDErrorCode.java index 02d8d66c9..fd51c69db 100644 --- a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsd/participants/XSDErrorCode.java +++ b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/xsd/participants/XSDErrorCode.java @@ -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"), // @@ -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: diff --git a/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/extensions/xsd/XSDValidationExtensionsTest.java b/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/extensions/xsd/XSDValidationExtensionsTest.java index cd3937e2a..0b3c20f1d 100644 --- a/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/extensions/xsd/XSDValidationExtensionsTest.java +++ b/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/extensions/xsd/XSDValidationExtensionsTest.java @@ -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 = "\r\n" + + "\r\n" + + " \r\n" + + ""; + testDiagnosticsFor(xml, d(2, 2, 2, 15, XSDErrorCode.s4s_elt_must_match_2)); + } + @Test public void s4s_att_must_appear() throws BadLocationException { String xml = "\r\n" + //