在 Scala 插件中控制错误的 IntelliJ 代码编辑器错误 [英] Controlling false IntelliJ code editor error in Scala plugin

查看:27
本文介绍了在 Scala 插件中控制错误的 IntelliJ 代码编辑器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从 ANTLR4 生成的 Java 代码.Scala 通过扩展一些方法来使用 Java 代码.问题是IntelliJ的scala插件好像不知道Java基类和Scala子类的关系,显示误报错误信息;当 Scala 覆盖 Java 方法时,它会报告方法......覆盖任何内容".

I have Java code generated from ANTLR4. Scala is using the Java code by extending some of the methods. The issue is that IntelliJ's scala plugin does not seem to know the relationship between Java base class and Scala subclass to show a false positive error message; it reports "Method ... overrides nothing" when Scala overrides Java method.

如何控制 IntelliJ 中的错误级别以抑制此错误消息?

How to control the error level in IntelliJ to suppress this error message?

推荐答案

Scala 插件产生的大部分误报都是由类型感知突出显示引起的:

Most of the false-negatives produced by Scala plugin are caused by type-aware highlighting:

现在你按下这个图标,你可以在任何地方禁用它,你的错误就会消失,但这意味着你会在任何地方丢失类型验证.

Now you pressing on this icon you can disable it everywhere and your error will be gone, but that means that you'll lose your type validation everywhere.

没有那么激进的方法.根据 IntelliJ 文档,将您的代码包含在 /*_*/.../*_*/,允许在本地禁用类型感知突出显示.

There is less radical approach. According to IntelliJ documentation, enclosing your code in /*_*/ ... /*_*/, allows to disable type-aware highlighting locally.

例如:

class Test {
}

class Test1 {
  /*_*/
  override def foo = 1
  /*_*/
}

在这种情况下,override def foo 将不会突出显示.

In this case, override def foo will not be highlighted.

这篇关于在 Scala 插件中控制错误的 IntelliJ 代码编辑器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆