How to find value by key in YML file

I'm trying to write plugin that helps me to easy find value by `actor.role.new`, `user.title` like keys in yml file

actor:
title: 'Actor title'
role:
new: 'New'
old: 'Old'
user:
title: 'Some title'

 

I've extended YamlRecursivePsiElementVisitor class, but I'm not sure which methods to override to easily read what I need.

0
1 comment

Hello!

Method org.jetbrains.yaml.YAMLUtil#getConfigFullName gives you 'key path'. Also look at org.jetbrains.yaml.navigation.YAMLKeysIndex and org.jetbrains.yaml.navigation.YAMLKeysSearchEverywhereContributor.

If you need to traverse YAML PSI tree then implement method visitKeyValue in visitor for work with map keys. Do not forgot to call super.visitKeyValue to visit value children (if you need it).

0

Please sign in to leave a comment.