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.
Related
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.
I'm using AppCode for Objective-C development. It seems like one of the recent updates has changed the behavior of how indents work after a comment.
Now, when I add a comment and then hit return to enter code on the next line I get this:
Hitting return again will keep the same level of indent, and hitting delete just returns the cursor to the comment line.
What I want is:
// Comment
self.theCodeStartsHere;
which I thought used to be the default.
I have also noticed that when I try to break a statement into multiple lines they no longer line up on the colons. I'm not sure if it's related, but the behavior seemed to start around the same time.
Any help would be appreciated!
After posting on YouTrack, this issue seems to be fixed in AppCode 2018.2 EAP.
EDIT: YouTrack Issue Link.
Is possible in IntelliJ to automatically update javadoc? For example, when I add new method params or throw new exceptions I want them to appear in the existing javadoc comment.
In IntelliJ 2019.2.4 you can open File/Settings/Keymap/Other then look for Fix doc comment and assign a shortcut to it.
This doesn't get at what you want, but may help others when SO search leads them here. The JavaDoc plugin generates javadoc where non exists. It's a bit dated (intellij 2020.1) and sometimes doesn't work in 2022.1 When it does work -- it's FANTASTIC!
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')
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...