Knows Not Much
Knows Not Much

Reputation: 31546

Disable IntelliJ inspection from comments

I have the following line in my code

val route = a :+: b :+: c 

IntelliJ 2017.3.2 Ultimate highlights this code and it says that Type annotation required for public member Except that the type of this variable is autogenerated and therefore its not practical for me to declare the type in code.

I tried

// scalastyle:off
 val route = a :+: b :+: c 
// scalastyle:on

but IntelliJ still gives me the warning. I wonder what can I do do disable the warning.

Note that I don't want to disable this for my entire project or file. I want this disabled just for this line nothing else.

Upvotes: 0

Views: 1024

Answers (2)

Jeremy
Jeremy

Reputation: 1924

To expand on Meo's answer a little bit, the comment you add to remove the type annotation inpsection would look like:

//noinspection TypeAnnotation
val route = a :+: b :+: c 

You can also add the comment above the method or class or whatever to disable that inspection for the entire scope.

For documentation on the keyboard shortcuts to use on mac or windows or linux, see here: https://www.jetbrains.com/help/idea/disabling-and-enabling-inspections.html

Upvotes: 0

Meo
Meo

Reputation: 12501

Put a caret on the highlighted text, and use Alt + Enter then Right Arrow to choose the appropriate action.

Upvotes: 1

Related Questions