Underlined variables.

Answered

Recently noticed that in some situations, there is an emphasis on variables. Perhaps this appeared after updating to version 2018.2.
I did not notice this before. What is it and can it be turned off? And is it worth it?

 

IntelliJ IDEA 2018.2 (Community Edition)
Build #IC-182.3684.101, built on July 24, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

11 comments
Comment actions Permalink

This is an interesting new code quality feature, but it seems to operate differently from the normal code warnings.

IntelliJ doesn't display a clickable light bulb to the left offering the option of disabling the warning for the variable / method / class level.

Can I change something in my config to enable that optional suppression?

If not, is there a @SuppressWarnings() label that I can employ manually?

Thanks

0
Comment actions Permalink

Hello Adam,

Actually it's not an inspection. Do you need to completely disable underlining?

 

0
Comment actions Permalink

OK. Are you saying that if it's not an inspection, I can't disable it in the code for the one or two situations where I don't want to see it, as I would for any of inspection? 

I don't want to disable it completely.

However where I'm really concerned about variable re-assignment, I just make the variable final. 

0
Comment actions Permalink

Yse, it's not possible to suppress it for custom place in code.

0
Comment actions Permalink

I guess I'll disable it then. I've got too many variables in my code that are, well, variable! 

2
Comment actions Permalink

To be honest, this is a very unwelcome feature... Could you guys disable it by default?

It will make `board[i][i]` looks like `board[i][j]` during when looping a 2d array. It took me 38 minutes to debug during leetcode contest. 

 

0
Comment actions Permalink

Let me put more comments on this feature. If a developer doesn't want a variable to be reassigned, I will use final keyword to enforce it. It's a compiler error, which is safer and more effective. You can also use const in c++, but c# doesn't have this feature....

A underscore warning is really unnecessary.

However, I do like Intellij. 

1
Comment actions Permalink

Thanks for your feedback, I've submitted a usability problem you can vote for: https://youtrack.jetbrains.com/issue/IDEA-207835.

1
Comment actions Permalink

Thank you, Serge.  This has been bothering me for months.  If anyone else ends up here trying to disable this anti-feature, please go vote for the issue above.  I suggested just changing it to an inspection which I can't imagine anyone would have a problem with.

Now I'll go disable it.

0
Comment actions Permalink

Been trying to hunt down the issue regarding that underline.

Hope this gets turned off by default too.

0

Please sign in to leave a comment.