繁体   English   中英

IntelliJ 插件开发 - 如何查找和分析调用?

[英]IntelliJ plugin development - How to find and analyze calls?

我正在为 IntelliJ IDEA 编写一个插件,主要目的是帮助我使用我自己的 API,现在我被卡住了。 我的 API 是这样使用的:

public class SomeClass {
    @Override
    public void specialMethod() {
        CustomCommand command = CommandManager.registerCommand(CommandClass.class, this);
        command.addMapper("mapper1", ...); // it doesn't matter what is here, the string is the only important thing here
    }
}
public class CommandClass extends AbstractCommandClass {
    public CommandClass(SpecialClass specialClass) {
        super(SpecialClass);
    }

    @Mapper("mapper1") // HERE
    public void someMethod() {
        // ...
    }
}

在注释@Mapper ,我使用的是字符串类型的键,并且希望我的插件使用addMapper方法验证该字符串是否已在SpecialClass中注册。 此外,可以有多个独特的映射器,所以我也想要这个建议。 我知道如何创建检查、意图和提供者,这里的主要问题是:如何正确收集所有使用过的字符串?

查看基于文件的索引

它以 map-reduce 方式工作。 基本上你指定一个文件到键 function,IDEA 会为你建立一个键到文件的索引。 如果文件发生更改,它将使索引保持最新,因此您无需担心。 甚至可以存储与密钥相关的附加数据。

然后可以按键查询文件,枚举索引中的所有键或文件等等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM