I'm unable to access a PHP Doc annotation element through PSI for element reference navigation
I've attached my code below and I've boldened the text which I would like to navigate with a reference. If I view the PSI tree, it's well and good. And if I debug my code using the inspector while running the IDE, I'm able to see that the tree is exactly the PSI tree described in the PSI tree. But with that very same pattern, I'm unable to access the element while registering it using registrar.registerReferenceProvider(). The only I'm able to access anything in the PHP Doc, is using PlatformPatterns.psiElement(). which is a catch all.
Any assistance would be really helpful. Thanks!
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Api;
class ProductRepositoryInterfaceTest
{
/**
* @magentoApiDataFixture Magento/Catalog/_files/product.php
*/
public function testGet()
{}
}
Please sign in to leave a comment.
Hello! Please try
This will fire on each word: `Magento`, `Catalog` and so on. Right now this is the only place that are open for references injection in php doc comments.
Thanks for your comment, Kirill Smelov. I understand the limitation. In that case, is it possible to create a custom PSI type perhaps to parse the entire value of a doc tag? Just thinking of possibilities to implement the same.
I'm afraid right now this is the only option available. You can create YT issue with request to expand our API though. IN your case you can still invoke getParent on identifier to make a decision and provide appropriate link on DOC_IDENTIFIER based on this.
I understand, thanks Kirill Smelov. Reaching out here, but is it at least possible to target the tag name and not the value? In my example, the "@magentoApiDataFixture"? Since I had already developed a solution like you suggested to target each doc identifier and get the context using getParent.