Search in sources :

Example 11 with YAMLKeyValue

use of org.jetbrains.yaml.psi.YAMLKeyValue in project intellij-community by JetBrains.

the class YAMLMappingModificationTest method doValueTest.

private void doValueTest(final String valueText) {
    myFixture.configureByFile(getTestName(true) + ".yml");
    final int offset = myFixture.getCaretOffset();
    final PsiElement elementAtCaret = myFixture.getFile().findElementAt(offset);
    final YAMLKeyValue keyValue = PsiTreeUtil.getParentOfType(elementAtCaret, YAMLKeyValue.class, false);
    assertNotNull(keyValue);
    final YAMLKeyValue dummyKV = YAMLElementGenerator.getInstance(myFixture.getProject()).createYamlKeyValue("foo", valueText);
    assertNotNull(dummyKV.getValue());
    WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> keyValue.setValue(dummyKV.getValue()));
    assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText(), false);
}
Also used : YAMLKeyValue(org.jetbrains.yaml.psi.YAMLKeyValue) PsiElement(com.intellij.psi.PsiElement)

Aggregations

YAMLKeyValue (org.jetbrains.yaml.psi.YAMLKeyValue)11 PsiElement (com.intellij.psi.PsiElement)5 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)3 YAMLValue (org.jetbrains.yaml.psi.YAMLValue)3 DocumentFragment (com.intellij.openapi.editor.DocumentFragment)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 PsiRecursiveElementVisitor (com.intellij.psi.PsiRecursiveElementVisitor)2 HashSet (com.intellij.util.containers.HashSet)2 YAMLDocument (org.jetbrains.yaml.psi.YAMLDocument)2 YAMLMapping (org.jetbrains.yaml.psi.YAMLMapping)2 ASTNode (com.intellij.lang.ASTNode)1 Module (com.intellij.openapi.module.Module)1 Pair (com.intellij.openapi.util.Pair)1 ProcessingContext (com.intellij.util.ProcessingContext)1 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)1