Yaml reconcile, detect 'missing anchor' reference
This commit is contained in:
@@ -19,7 +19,9 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.Reconcile
|
||||
import org.springframework.ide.vscode.commons.util.text.IDocument;
|
||||
import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider;
|
||||
import org.springframework.ide.vscode.commons.yaml.ast.YamlFileAST;
|
||||
import org.yaml.snakeyaml.composer.ComposerException;
|
||||
import org.yaml.snakeyaml.error.Mark;
|
||||
import org.yaml.snakeyaml.error.MarkedYAMLException;
|
||||
import org.yaml.snakeyaml.parser.ParserException;
|
||||
import org.yaml.snakeyaml.scanner.ScannerException;
|
||||
|
||||
@@ -45,11 +47,7 @@ public abstract class YamlReconcileEngine implements IReconcileEngine {
|
||||
if (reconciler!=null) {
|
||||
reconciler.reconcile(ast);
|
||||
}
|
||||
} catch (ParserException e) {
|
||||
String msg = e.getProblem();
|
||||
Mark mark = e.getProblemMark();
|
||||
problemCollector.accept(syntaxError(msg, mark.getIndex(), 1));
|
||||
} catch (ScannerException e) {
|
||||
} catch (MarkedYAMLException e) {
|
||||
String msg = e.getProblem();
|
||||
Mark mark = e.getProblemMark();
|
||||
problemCollector.accept(syntaxError(msg, mark.getIndex(), 1));
|
||||
|
||||
@@ -4928,6 +4928,22 @@ public class ConcourseEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void referenceToMissingAnchor() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
"repo-dflts: &repo-dflts\n" +
|
||||
" bogus: bar\n" +
|
||||
"resources:\n" +
|
||||
"- name: foo\n" +
|
||||
" type: git\n" +
|
||||
" source:\n" +
|
||||
" <<: *TYPO\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"*|undefined alias TYPO"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anchorsAndReferenceSample_1() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
|
||||
Reference in New Issue
Block a user