简体   繁体   English

Intellij将警告显示为错误

[英]Intellij show warnings as errors

A feature I like in eclipse the most is that it easily shows me all my errors and warnings in the code (in a list) 我在Eclipse中最喜欢的一个功能就是它可以很容易地在代码中显示我的所有错误和警告(在列表中)

Also - by each file there is a mark whether the file has warnings/errors 此外 - 每个文件都有一个标记文件是否有警告/错误

In Intellij I found it rather challenging... So for all the Intellij experts out there - 在Intellij中,我发现它颇具挑战性......所以Intellij的所有专家都在那里 -

  1. Is there a way so show warnings in a list (I saw something similar in the messages toolbar but it dissapears when there are no compilation errors) 有没有办法在列表中显示警告(我在消息工具栏中看到了类似的东西但是在没有编译错误时消失了)

  2. How can I see if a file has warnings without looking into it's contents? 如何在不查看文件内容的情况下查看文件是否有警告?

Thanks! 谢谢!

Also I like error/warning list that appears when trying to commit file into Subversion. 我也喜欢在尝试将文件提交到Subversion时出现的错误/警告列表。 If any errors or warnings present in file, IDEA shows popup window with Review button. 如果文件中存在任何错误或警告,IDEA会显示带有Review按钮的弹出窗口。 This button opens Message sub-window with very handy and good-looking errors/warnings list. 此按钮打开Message子窗口,其中包含非常方便且美观的错误/警告列表。

PS Also may be helpful Build -> Rebuild Project PS也可能有用Build - > Rebuild Project

PS2. PS2。 Also see about displaying warnings here: Warnings in IntelliJ IDEA v12 另请参阅此处显示警告: IntelliJ IDEA v12中的警告

I think what you're looking for is "Inspect Code" under the "Analyze" menu. 我认为您正在寻找的是“分析”菜单下的“检查代码”。 It allows you to specify which inspections you want to run (called an Inspection Profile) and on what set of files, and puts them all in a window to let you look through them and resolve them. 它允许您指定要运行的检查(称为检查配置文件)和文件集,并将它们全部放在窗口中以便您查看并解决它们。

See Code Inspection in the documentation for more information. 有关详细信息,请参阅文档中的代码检查

If you do build->rebuild project in IntelliJ, the messages tab (usually at the bottom) should show all the warnings. 如果在IntelliJ中执行build-> rebuild项目,则消息选项卡(通常位于底部)应显示所有警告。 They should not disappear anywhere even after compiler has finished. 即使在编译器完成后,它们也不应该在任何地方消失。 If they do, check you have not enabled the "hide warnings" icon on the messages tab. 如果是,请检查您是否未在消息选项卡上启用“隐藏警告”图标。

I guess the difference with Eclipse is due to Eclipse always running the background compiler and also collecting the warnings. 我想与Eclipse的区别在于Eclipse始终运行后台编译器并收集警告。 IntelliJ runs its own parser and highlights errors in the source tree, haven't really needed the warnings to be displayed always so not sure how to do that. IntelliJ运行自己的解析器并突出显示源树中的错误,并不总是需要始终显示警告,因此不确定如何执行此操作。

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

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