LanguageTextField turns off Java file detection

已回答

 

I wrote a piece of Java code using LanguageTextField, but it may have reported an error because there is no file name that matches the class name. How to turn off this detection

 

0

Please clarify what you want to achieve. Do you want to disable all analysis or only this particular one?

0

I just want to disable this one

0

I don't see any direct API that allows disabling this in LanguageTextField.

The error is added in:
https://github.com/JetBrains/intellij-community/blob/master/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java#L295-L329

You can try to implement an error filter to disable it in your language text field context:
https://plugins.jetbrains.com/docs/intellij/controlling-highlighting.html

0

This method is effective. I have registered the following extensions

   <daemon.highlightInfoFilter implementation="com.test.HighlightInfoFilterImpl"/>

But the disadvantage is that it is effective for all editors, is there a way to only face the specified EditorTextField,

 

I couldn't find the relevant API

0

The only way I see is debugging and checking whether you can determine the context from the accept method's parameters: HighlightInfo and PsiFile.

0

请先登录再写评论。