如何在 PhpStorm 中按位置模式自动注入语言以实现功能?

Ant*_*dev 3 intellij-idea phpstorm

如何配置 PhpStorm 在run(...)函数调用中自动注入 Bash ?例如,我想在这里注入 bash:

run("mv source dest && echo 'bash';");
Run Code Online (Sandbox Code Playgroud)

这不起作用:

+ phpLiteralExpression().withText("run")
Run Code Online (Sandbox Code Playgroud)

Bas*_*ers 5

尝试以下地点模式:

+ phpLiteralExpression().withSuperParent(2, phpFunctionReference().withText(string().startsWith("run(")))
Run Code Online (Sandbox Code Playgroud)

不幸的是,没有关于此功能的文档,实际上文档特别警告:

这些规则是 PhpStorm 内部规则,强烈建议您使用预定义的注入配置并避免创建新的配置。

所以在实践中需要查看IntelliJ IDEA的源码。感兴趣的类是com.intellij.patterns.PlatformPatternsandcom.intellij.patterns.PsiElementPattern和它们的各种超类。