…today I was about to write a VSCode Extension, because I was missing functionality that isn’t there out of the box: Open a snippet by clicking the parent <?php snippet() ?> tag.
In the process I found regex-robin.
Regex Robin is a VS Code extension that allows you to customize the appearance of text in your editor using regex patterns, as well as creating links and hover messages.
It’s possible to configure it to check for snippet() calls in PHP files, highlight them and make them clickable to navigate to it’s content (press ALT to open in split view).
"regexrobin.rules": [
{
"regex": "snippet\\(['\"]([^'\"]+)['\"]",
"languages": ["php"],
"editor": [
{
"link": "${workspaceFolder}/site/snippets/$1.php",
},
],
},
],
Maybe it helps someone else.
Tschüss,
Hans
