将功能使用和声明映射到快速导航

时间:2017-04-14 15:00:28

标签: javascript php phpstorm webstorm jsdoc

PhpStorm具有快速导航到功能声明的功能。

在我目前的工作项目中,我面临生成使用功能名称的情况取决于使用过的组件。

  

组件1

function selectOneFile(id){
    //complex logic
}
  

组件2

function selectTwoFile(id){
    //another complex logic
}
  

调用函数的位置

<?php $components = [0  => 'One', 1 => 'Two'] ?>

var fileId = $(someComponent).data('id');
select<?php echo $components[$_POST['component_id']]  ?>File(fileId);

我无法重写功能

selectFile(fileId,'<?php echo $components[$_POST['component_id']]  ?>');

因为这个函数的逻辑内部非常不同。

此外,我不能仅为此功能使用一个名称,因为这种组件在一个页面上加载了一个案例,而在另一个案例中,它只在页面上加载了一个组件。

我想在功能声明及其用法之间导航:当我在Ctrl+B上按selectOneFile(id)时,它会显示我的使用情况

select<?php echo $components[$_POST['component_id']]  ?>File(fileId) 

当我按下Ctrl+B

select<?php echo $components[$_POST['component_id']]  ?>File(fileId)

我会看到声明selectOneFile(id)selectTwoFile(id)

有没有办法在声明和使用之间进行映射?

0 个答案:

没有答案
相关问题