Reputation: 3221
Is there a feature or a plugin to create a link to a local project file like this:
/**
* @see ./views/templates/file.twig
*/
public function render()
{
..
}
That would very useful for jumping between files.
I've found this plugin, but is seems like it is no longer maintained or not supported in PhpStorm > 2016:
https://plugins.jetbrains.com/plugin/7235?pr=phpStorm
Upvotes: 14
Views: 3393
Reputation: 144
I was looking for a solution and found this that works. I found it on a phpDocumentor issue and it might work on VSCode as well as PhpStorm (I tested the PhpStorm 2024.3 version).
enter code here
/**
* @see project://views/templates/file.twig
* @link project://views/templates/file.twig
*
* Architecture Decisions: {@link /docs/adr.md}
* @link /docs/simple_file_names.md
*/
public function render()
{
..
}
Both @see
or @link
works if you put this part as prefix project://
. I prefer @link
one.
If the file name does not have -
or other special chars, _
looks like it works, you can use normal version @link /views/templates/file.twig
even if you put it inline. But if you have wired file names, the one with project://
should work.
Note that @see
should be mostly used to reference other PHP code/method/class, see: PhpDocumentor @see
Upvotes: 1
Reputation: 13
I'm using fake functions in files:
if (!function_exists('fakefunction___link')) {
function fakefunction___link() {
return null;
}
}
Then in another PHP file i have:
/** @see fakefunction___link */
Upvotes: 1
Reputation: 282
PhpStorm 2023.2:
/**
* @see /README.md # It works
* @see /.gitignore # It doesn't work (hidden files)
*/
class SomeClass
{
// ...
}
Upvotes: 2