IntelliJ不显示语法错误/不提供任何建议。

huangapple go评论66阅读模式
英文:

Intellij does not show any errors in the syntax/does not give any suggestions

问题

有一些类似的帖子,但没有一个似乎包含了我问题的答案。

我的IDE没有显示任何错误,没有给出任何建议,也没有导入任何内容。例如:

public static String createInversion(ArrayList<String> splitName) {
    splitName.removeIf(n -> List.of("Lord", "Lady").contains(n));
    ArrayList<String> reverted = List.newArrayList(splitName.stream()
        .collect(Collector.toCollection(LinkedList::new))
        .descendingIterator());
    return String.format("%s, %s", splitName.get(1), splitName.get(0));
    gyugyuihu
    dsfsdf
    rewfewr
}

您可以清楚地看到,最后三行是随机的字母链,没有任何上下文。我的IDE没有突出显示它们,也没有报告任何问题。我甚至不知道是否应该使用Collector还是Collectors类,因为我没有得到任何建议,就像在Word文档中编写一样。

只有在我尝试编译时,我才会得到错误,而且仅在终端中显示。代码在Intellij中保持不变。

我没有打开Power Safe模式,SDK设置正确,模块中的语言级别设置正确,设置 -> 构建、执行、部署 -> Java编译器 -> 目标字节码版本设置正确,主文件夹被标记为源根。

我已经没有更多的想法了。请帮忙。

编辑:
添加了我的设置的屏幕截图。
IntelliJ不显示语法错误/不提供任何建议。

英文:

There's a couple of similar threads, but none seems to contain the answer to my issue.

My IDE does not show any error, does not give any suggestions, does not import anything. Example:

public static String createInversion(ArrayList&lt;String&gt; splitName) {
        splitName.removeIf(n -&gt; List.of(&quot;Lord&quot;, &quot;Lady&quot;).contains(n));
        ArrayList&lt;String&gt; reverted = List.newArrayList(splitName.stream()
        .collect(Collector.toCollection(LinkedList::new))
        .descendingIterator());
        return String.format(&quot;%s, %s&quot;, splitName.get(1), splitName.get(0));
        gyugyuihu
                dsfsdf
                rewfewr
    }

You can clearly see that the last three lines are random chains of letters without any context. My IDE does not highlight them, does not report any problems. I don't even know if I should use Collector or Collectors class, because I am given zero suggestions, it's like writing in a Word Document.

I am only given errors the moment I try to compile, but also just in the terminal. The code remains untouched by Intellij.

I do not have the Power Safe Mode on, SDK is set correctly, language level in Modules is set correctly, Settings -> Build, Execution, Deployment -> Java Compiler -> Target Bytecode Version is set correctly, the main folder is marked as the Source Root.

I am out of ideas. Please help.

EDIT:
Adding a screenshot of my setup.
IntelliJ不显示语法错误/不提供任何建议。

答案1

得分: 2

你尝试过清除缓存吗?通常这样做可以解决这类问题。而且操作很简单:从主菜单中,选择文件 | 清除缓存 / 重新启动。

英文:

Have you tried to invalidate the caches? That usually clears up issues like this. It's easy to do too: From the main menu, select File | Invalidate Caches / Restart.

答案2

得分: 0

如上所述,请尝试清除缓存/重新启动(文件 -> 清除缓存/重新启动)

如果这没有起作用,请检查 pom 文件名是否被删除线划掉。如果 pom 文件被划掉了
IntelliJ IDEA -> 选择“构建、执行、部署” -> 选择“构建工具” -> maven -> 选择“忽略的文件” - 检查是否在忽略文件中有 pom。如果有,取消勾选它。然后执行 mvn clean install

英文:

As mentioned above try to do invalidate caches/Restart( File -> invalidate caches/Restart)

If it did not work then check pom file name is not strikethrough. If pom file has strikethrogh then
IntelljIdea -> Select Build,Execution,Deployment -> Select Build Tools -> maven -> Select Ignored Files - Check pom is present in ignore file. If yes then uncheck it . and do mvn clean install

huangapple
  • 本文由 发表于 2020年10月5日 13:52:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/64203073.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定