How to insert new YAML key/blocks?



i have a YAML file, which i want to change in 2 ways:


1. I want to change the value of the node, but i honestly have no idea how. I tried to instantatiate the YAMLValue, but i just dont get it to work.

var result = YAMLUtil.getQualifiedKeyInFile((YAMLFile) psiFile,"test","abc", "super");
result.setValue(/* HOW TO insert "2" or 2? */);

2. I want to add a new block to a YAML file, but since i even struggle to change the value, i struggle even more with creating such a block

var result = YAMLUtil.getQualifiedKeyInFile((YAMLFile) psiFile,"test","abc");
// result.addBlock(new Block("super")) HOW?


I hope you can help me. Thanks

1 comment


You can create a new dummy file with the minimal structure covering an element you want to add, then take this element and use it in adding/setting methods.



Please sign in to leave a comment.