void (JsonPathFile jsonPathFile) { jsonPathFile.accept(new JsonPathRecursiveElementVisitor() { @Override public void visitIdSegment(@NotNull JsonPathIdSegment o) { super.visitIdSegment(o); JsonPathId id = o.getId(); if (!id.getTextRange().isEmpty()) { String literalText = getElementTextWithoutHostEscaping(id); if (!StringUtil.isEmptyOrSpaces(literalText)) { pathNameConsumer.accept(literalText); } } } @Override public void visitExpressionSegment(@NotNull JsonPathExpressionSegment o) { super.visitExpressionSegment(o); JsonPathQuotedPathsList quotedPathsList = o.getQuotedPathsList(); if (quotedPathsList == null) return; for (JsonPathStringLiteral stringLiteral : quotedPathsList.getStringLiteralList()) { String literalText = getElementTextWithoutHostEscaping(stringLiteral); if (literalText != null) { String literalValue = StringUtil.unquoteString(literalText); if (!StringUtil.isEmptyOrSpaces(literalValue)) { pathNameConsumer.accept(literalValue); } } } } private String getElementTextWithoutHostEscaping(@NotNull PsiElement element) { if (injectedLanguageManager.isInjectedFragment(element.getContainingFile())) { return injectedLanguageManager.getUnescapedText(element); } else { return element.getText(); } } }); }