From 8bd458e66c5a108ccc508e7fba3fb45cc22e9e16 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 23 Nov 2020 14:37:28 +0100 Subject: [PATCH] updated orbit repo for 2020-12 m3 and fixed compile issue due to updated snakeyaml version --- eclipse-distribution/pom.xml | 2 +- .../yaml/reconcile/YamlSchemaProblems.java | 23 ++++++++++++++++--- eclipse-language-servers/pom.xml | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/eclipse-distribution/pom.xml b/eclipse-distribution/pom.xml index b50955c83..c8a0746ae 100644 --- a/eclipse-distribution/pom.xml +++ b/eclipse-distribution/pom.xml @@ -373,7 +373,7 @@ orbit p2 - https://download.eclipse.org/tools/orbit/downloads/drops/S20200826182026/repository + https://download.eclipse.org/tools/orbit/downloads/drops/S20201118210000/repository m2e diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/reconcile/YamlSchemaProblems.java b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/reconcile/YamlSchemaProblems.java index e14d15ab9..9168d46f3 100644 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/reconcile/YamlSchemaProblems.java +++ b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/reconcile/YamlSchemaProblems.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Pivotal, Inc. + * Copyright (c) 2016, 2020 Pivotal, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,6 +19,7 @@ import org.springframework.ide.eclipse.editor.support.util.DocumentRegion; import org.springframework.ide.eclipse.editor.support.yaml.ast.NodeUtil; import org.springframework.ide.eclipse.editor.support.yaml.schema.YType; import org.springframework.ide.eclipse.editor.support.yaml.schema.YTypedProperty; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.error.Mark; import org.yaml.snakeyaml.nodes.MappingNode; import org.yaml.snakeyaml.nodes.Node; @@ -84,17 +85,33 @@ public class YamlSchemaProblems { int end = node.getEndMark().getIndex(); return new ReconcileProblemImpl(SCHEMA_PROBLEM, msg, start, end-start); } + public static ReconcileProblemImpl missingProperty(String msg, IDocument doc, Node parent, MappingNode map) { DocumentRegion underline = NodeUtil.region(doc, map); + if (parent instanceof MappingNode) { for (NodeTuple prop : ((MappingNode) parent).getValue()) { if (prop.getValueNode()==map) { underline = NodeUtil.region(doc, prop.getKeyNode()); } } + } else if (parent instanceof SequenceNode) { - Boolean flowStyle = ((SequenceNode) parent).getFlowStyle(); - if (flowStyle!=null && !flowStyle) { + Object flowStyle = ((SequenceNode) parent).getFlowStyle(); + boolean flow = false; + + // check the type of the flow style, since that return type changed between snakeyaml versions + // from Boolean to DumperOptions.FlowStyle, so this type check allows us to compile against and + // work with both versions (1.14 and 1.27) + if (flowStyle instanceof Boolean) { + flow = ((Boolean)flowStyle).booleanValue(); + } + else if (flowStyle instanceof DumperOptions.FlowStyle) { + DumperOptions.FlowStyle style = (DumperOptions.FlowStyle) flowStyle; + flow = style.getStyleBoolean(); + } + + if (!flow) { Mark nodeStart = map.getStartMark(); underline = new DocumentRegion(doc, 0, nodeStart.getIndex()); underline = underline.trimEnd(); diff --git a/eclipse-language-servers/pom.xml b/eclipse-language-servers/pom.xml index badcc003a..a6aedd85c 100644 --- a/eclipse-language-servers/pom.xml +++ b/eclipse-language-servers/pom.xml @@ -248,7 +248,7 @@ orbit p2 - https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository + https://download.eclipse.org/tools/orbit/downloads/drops/S20201118210000/repository mylyn-markdown