How can I get rid of the unnecessary line breaks in the Java code editor (see screenshot). This formatting seems to apply just to one project. When I create new projects, there is no extra line spacing.
Thanks!
I believe this is related to Inlay Hints. I had the same issue and it was driving me nuts, then after a restart a bunch of code hints showed up. While useful in the right circumstance, it was a bit baffling when all I could see were these ghost lines.
After disabling "Code vision" the issue resolved itself.
Go to settings (Ctrl-Alt-S), under Editor-Inlay Hints there is a checkbox for Code vision. Uncheck that and see if that helps.
This appears to be an issue with the 2022.1 version of IDEA. I had the same symptoms and downgraded to 2021.3. Poof, problem solved. Hopefully they fix this in a newer version soon.
This is indeed related to Editor -> Inlay Hints -> Code vision settings, but for me, it is the Code author option specifically that is adding the seemingly-needless lines.
It seems like IntelliJ creates affordance for the Code author value, but (for me) the value is empty so there is actually nothing showing.
I leave the other Code vision options enabled and just disable the Code author and this appears to be working well so far.
Related
How to get rid of this highlighted part. It is not code but IntelliJ is trying to make this code more readable by suggesting this. It is super irritating
I expect code to be viewed in simple way
I disabled the inlay hints for everything from IntelliJ settings and Now issue is resolved
I am following the Atomic Kotlin course. I have understood the concept and my output is correct, however Intellij IDEA complains that the outputs are different. Even when I copy and paste from the answer. Please see screenshot.
I have tried using the print() method instead of println(), but it didn't help.
Go to Settings->Editor->General and uncheck the Ensure an empty line.. property.
see the following screenshot:
There is a straightforward workaround on how one can avoid this problem. Changing the AtomicKotlin/Programming Basics/Data Types/Exercise 2/test/output.txt manually to add a new line at the end of the text should fix the test.I've also found a YouTrack ticket with the problem description. According to it, EduTools 4.2 version release should fix it. Maybe it worth to upvote or comment on the ticket.
Is it possible to disable duplicate code detection in Intellij?
I haven't found this feature to be useful and it continues to distract me.
Only available in IntelliJ Ultimate:
To disable duplicate code detection, go to
File → Settings → Editor → Inspections → General → Duplicated code fragment
and uncheck box "Duplicate code fragment".
Add a hint to your code so that others will know your intent:
#SuppressWarnings("Duplicates")
Yes, it's possible, but I would strongly advise against it!
Duplicate code is a form of technical debt. Any duplicated code that contains a bug means you now have a duplicated bug - you then run the risk that when you fix it, you'll only fix it in one place and the duplicate will remain...
If duplicate code warnings are distracting you, then the best strategy for getting rid of them is to remove the code duplication... Your codebase and future maintainers will thank you for it
This answer may be little irrelevant, but I found this helpful,
From this answer if you want to disable it for a specific code block, not the entire method or class or ide, then just add the following line just before that code block
//noinspection Duplicates
Note: You can not put any other comment after this line.
Could not get any of these answers to work in Webstorm.
To work around this without turning this feature off, I added this line of code:
if (Math.random() === 1) console.info('suppress duplicate code warning')
This makes the warning disappear if you add it in 1 of the 2 dupe files since they are not dupe anymore.
Another alternative if you are using lodash is:
noop('suppress duplicate code warning')
Recently I was using Aptana to view multiple files side by side. The unfortunate thing is that now I can not remove the editor (side by side) windows that are marked by red arrows. Also, you can obviously see that I have been trying to drag them away which is making the problem worse. I have tried to Google around but have found no solution. I can uninstall and reinstall Aptana, but if there is a fix I would rather know it and not have to go through a reinstallation process each time an issue like this arises.
Also I would like to add that I may be having trouble Googling the solution since I am not 100% sure on the name of the "editor tabs". Any help would be greatly appreciated.
My reputation is too low so here is a image link of my issue:
http://i.imgur.com/6K3Dq.png
The answer is extremely simple. If you ever run into the issue as shown in the picture above, simply open new files and drag them into the empty spaces that the extra "editor windows" are located. From there just close (x) out the window and it will remove the extra windows.
It really annoys me that IntelliJ highlights certain 'errors' (that don't prevent successful compilation) the same way that real errors are highlighted. For example, a magic number is not really an error, but it will be flagged in exactly the same way as an incompatible type error.
How can I change this?
Go to Settings -> Inspections. Then you need to search through the long list for the offending inspection, which you can get the name of by hovering on the warning marker in the margin. You can change the severity of the inspection, whether it's an error, warning, etc. or just disable it altogether.
Edit: if you search for "magic" in Settings, you get the following, which should be helpful:
Whenever you see an inspection warning/error you can place the caret on it and press Alt+Enter (a light bulb also appears that tells you that). A menu will appear with suggested quick fixes. You may need to open a submenu by pressing Right, and you'll find "Edit inspection settings" there. Having invoked that, you may proceed as in hvgotcodes's answer :), it's just a faster way of getting to those settings.
As Michael Calvin said you can use the SuppressWarnings annotation. For example:
#SuppressWarnings("OptionalUsedAsFieldOrParameterType")
See https://github.com/JetBrains/intellij-community/blob/master/plugins/InspectionGadgets/src/inspectionDescriptions/OptionalUsedAsFieldOrParameterType.html
Usually searching the internet for the exact description leads me to this.
Not directly relevant to the OP, but may be of use to future Googlers
I got to this question while trying to figure out how to disable IntelliJ IDEA's warnings about Guava functionalities that have been replaced by Java 8 features. I'm not able to use the Java 8 versions of these features in my case because of a library we're using that was built with Guava (despite being a Java 8 project). So to solve that, I added a SuppressWarnings annotation before any class using Guava:
#SuppressWarnings(Guava)
public final class...