【问题标题】:Ignore certain inspections忽略某些检查
【发布时间】:2018-10-30 04:32:47
【问题描述】:

在某些情况下,检查相当烦人,甚至会提到文件有错误。

使用// ignore: argument_type_not_assignable 会抑制错误消息。虽然我经常使用这个,但是让这个评论在代码库中传播很烦人。

Settings > Inspections 中找不到任何既不是Dart 也不是General 的东西。

有没有办法禁止特定检查?

【问题讨论】:

  • 不确定您要在这里实现什么,因为then 的参数是完全错误的,它不会起作用。在 Dart 2 中,这将是一个编译时错误,再多的忽略警告都不会使它编译。它当前可能在编译为 JavaScript 时无需检查即可运行,但这确实是编译的意外,而不是我建议您依赖的东西。只需写.then((_) => print('finished'))
  • 是的,我才注意到我问了之后,我会更新问题。谢谢

标签: intellij-idea dart


【解决方案1】:

您可以使用analysis_options.yaml 文件进行配置

https://www.dartlang.org/guides/language/analysis-options

analyzer:
  errors:
    argument_type_not_assignable: ignore

另见Suppress hint about use of protected member

【讨论】:

    猜你喜欢
    • 2016-04-25
    • 1970-01-01
    • 2022-01-09
    • 1970-01-01
    • 1970-01-01
    • 2014-07-09
    • 2011-03-21
    • 2018-06-26
    • 2012-07-28
    相关资源
    最近更新 更多