Search in sources :

Example 11 with SRootNode

use of org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode in project sts4 by spring-projects.

the class YamlStructureParserTest method findAndTraversPathPath.

private void findAndTraversPathPath(MockYamlEditor editor, String snippet) throws Exception {
    SRootNode root = editor.parseStructure();
    SNode node = root.find(editor.startOf(snippet));
    assertNotNull(node);
    YamlPath path = node.getPath();
    SNode actualNode = path.traverse((SNode) root);
    assertEquals(node, actualNode);
}
Also used : YamlPath(org.springframework.ide.vscode.commons.yaml.path.YamlPath) SRootNode(org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode) SNode(org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode)

Example 12 with SRootNode

use of org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode in project sts4 by spring-projects.

the class YamlStructureParserTest method testTreeEndKeyNodeNoChildren.

@Test
public void testTreeEndKeyNodeNoChildren() throws Exception {
    MockYamlEditor editor = new MockYamlEditor("world:\n" + "  europe:\n" + "  canada:\n" + "    montreal: poutine\n" + "    vancouver:\n" + "      salmon\n" + "moon:\n" + "  moonbase-alfa:\n" + "    moonstone\n");
    SRootNode root = editor.parseStructure();
    SNode node = getNodeAtPath(root, 0, 0, 0);
    assertTreeText(editor, node, "  europe:");
}
Also used : SRootNode(org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode) SNode(org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode) Test(org.junit.Test)

Aggregations

SRootNode (org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode)12 Test (org.junit.Test)10 SNode (org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode)6 YamlPath (org.springframework.ide.vscode.commons.yaml.path.YamlPath)4 ArrayList (java.util.ArrayList)1 ICompletionProposal (org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal)1 YamlDocument (org.springframework.ide.vscode.commons.yaml.structure.YamlDocument)1