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

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

请先登录再写评论。