ivate static @NotNull YAMLAliasResolveResult getResolveData(@NotNull PsiFile file) {
    return CachedValuesManager.getCachedValue(file, () -> {
      Map<YAMLAlias, YAMLAnchor> resolveMap = new HashMap<>();
      Map<String, YAMLAnchor> defMap = new HashMap<>();

      // store first definitions: need for completion
      Map<String, YAMLAnchor> firstDefMap = new HashMap<>();

      file.accept(new YamlRecursivePsiElementVisitor() {
        @Override
        public void visitAnchor(@NotNull YAMLAnchor anchor) {
          defMap.put(anchor.getName(), anchor);
          firstDefMap.putIfAbsent(anchor.getName(), anchor);
        }
        @Override
        public void visitAlias(@NotNull YAMLAlias alias) {
          String name = alias.getAliasName();
          YAMLAnchor anchor = defMap.get(name);
          if (anchor != null) {
            resolveMap.put(alias, anchor);
          }
        }
      });
      Set<YAMLAnchor> firstDefs = new HashSet<>(firstDefMap.values());
      YAMLAliasResolveResult result = new YAMLAliasResolveResult(resolveMap, firstDefs);
      return CachedValueProvider.Result.create(result, file);
    });
  }


ivate static @NotNull YAMLAliasResolveResult getResolveData(@NotNull PsiFile file) {