【问题标题】:custom lint Android-Studio-tooltip not showing explanation自定义 lint Android-Studio-tooltip 未显示说明
【发布时间】:2017-07-20 10:10:47
【问题描述】:

我正在编写自定义 lint 规则,应该在 Android Studio 中显示。一切正常,除非我单击“更多...”链接以查看有关 lint 错误的进一步解释。它总是说“正在建设中”。我不知道为什么,这是一个错误还是我做错了什么?

Detector.class 的提取:

public class MyDetector extends Detector implements Detector.GradleScanner {

static Implementation IMPLEMENTATION = new Implementation(
        MyDetector.class,
        Scope.GRADLE_SCOPE
        );

public static final Issue COMPATIBILITY = Issue.create(
        "id here",
        "brief desc",
        "longer explanation",
        Category.CORRECTNESS,
        5,
        Severity.WARNING,
        IMPLEMENTATION);

@Override
public void visitBuildScript(@NonNull Context context, 
                                Map<String, Object> sharedData) {
    context.report(
        COMPATIBILITY,
        getLocation(),
        "report id"
    );
}

我正在使用:

Android Studio 2.3.3
Build #AI-162.4069837, built on June 6, 2017
JRE: 1.8.0_112-release-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

依赖关系:

compile 'com.android.tools.lint:lint-api:25.2.0'
compile 'com.android.tools.lint:lint-checks:25.2.0'
compile 'com.android.tools.lint:lint:25.2.0'

...

com.android.tools.build:gradle:2.2.0

将鼠标悬停在 lint 问题上时的工具提示:

lint html 看起来不错

【问题讨论】:

    标签: android android-studio lint android-lint


    【解决方案1】:

    这是对自定义 lint 规则的限制。但是,如果将光标移动到该行并单击alt + return,则可以看到“显示完整说明”选项。那是“更长的解释”字段将显示的地方。

    See the Screenshot

    【讨论】:

    • 如您在屏幕截图中所见,“更多”已被点击。实际上,在单击“更多”后,会出现“正在建设”字符串....(mac/windows 上的快捷方式不同,我猜你使用的是 windows - 我使用的是 mac)
    • 我也用mac。尝试“选项+返回”。 alt 键与 mac 上的 option 键相同。说光标,我指的是 IDE 中的光标,而不是鼠标。另见我添加的附件
    猜你喜欢
    • 2014-12-23
    • 1970-01-01
    • 2021-03-17
    • 1970-01-01
    • 1970-01-01
    • 2011-07-20
    • 2016-03-21
    • 2016-12-13
    • 2020-08-21
    相关资源
    最近更新 更多