Search in sources :

Example 11 with SNode

use of org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode 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 SNode

use of org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode 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)

Example 13 with SNode

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

the class YamlStructureParserTest method assertFindStart.

private void assertFindStart(MockYamlEditor editor, SRootNode root, String snippet, int... expectPath) {
    int start = editor.getRawText().indexOf(snippet);
    SNode expectNode = getNodeAtPath(root, expectPath);
    assertEquals(expectNode, root.find(start));
}
Also used : SNode(org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode)

Aggregations

SNode (org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SNode)13 SRootNode (org.springframework.ide.vscode.commons.yaml.structure.YamlStructureParser.SRootNode)6 YamlPath (org.springframework.ide.vscode.commons.yaml.path.YamlPath)5 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 ICompletionProposal (org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal)2 ValueParseException (org.springframework.ide.vscode.commons.util.ValueParseException)2 YamlPathSegment (org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment)2 SNodeDynamicSchemaContext (org.springframework.ide.vscode.commons.yaml.schema.SNodeDynamicSchemaContext)2 Strings (com.google.common.base.Strings)1 ImmutableList (com.google.common.collect.ImmutableList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 DocumentEdits (org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits)1