I somehow manages to change my settings such that I do not get the suggestion for generating getter/setter methods. At least not for all types.
The image below shows that name, in contrast to the fields id and appUser, is not greyed out:
Pressing Alt + Enter I get a suggestion for "Create getter and setter" for id
But this does not happen for the field name:
I remember pressing Enter accidentally and since then my settings seems to be messed up. Since I couldn't find anything in Settings I was hoping somebody could help me out here.
The fix to generate Getter/Setter was suggested by Unused Declaration inspection (Java | Declaration redundancy | Unused declaration).
Also the fix to suppress the inspection is suggested in case it's annotated by particular annotation:
Probably you've mistakenly applied the suppression, so the #Column annotation was added to "Entry points" list.
To remove the annotation from this list do the following:
- open the inspection's settings -> Entry points pane:
press the "Annotations..."
and remove the #Column annotation from the list
save
Related
Every time I extract method, this line is generated "for me":
#org.jetbrains.annotations.NotNull
around the method. 1. I don't have this on my class path, so it does not compile 2. even if I have, I don't want to include jetbrains annotations in my project. Even if I have more suitable (maybe) javax.validation.constraints.NotNull annotation on class path, intellij does not use that one.
questions:
how to turn it off entirely?
how to customize, which annotation to use?
The extract method dialog has a Generate annotations check box. When disabled it does not generate the nullability annotations. The state of this check box is remembered between invocations, so disabling it once is enough.
If this check box does not appear, annotations for the extracted method should not be generated.
It is possible to customize the annotation used in the settings of the Java | Probable bugs | Constant conditions & exceptions inspection. The configuration dialog looks this:
Use the check mark button, to mark the selected annotation as the one that should be used for code generation.
I ran into the same problem and was able to fix it by follow these steps :
Go to Settings > Editor > Inspections >
Find Java > Probable Bugs > Nullability Problems > #NotNull/#Nullable Problems
Click Configure Annotations button and check these items
For one of my enum classes I'd like to use non-standard naming:
enum class MyEnum {
I_like_to_use,
This_strange_naming_here
}
The IDE (and code inspection) rightfully complains with:
Enum entry name 'This_strange_naming_here' doesn't match regex '[A-Z]([A-Za-z\d]*|[A-Z_\d]*)'.
This inspection reports enum entry named that do not follow the recommended naming conventions.
However in this case, I would like to actively suppress this warning. I tried with #Suppress("naming"), but to no avail.
For Kotlin/Java add
#Suppress("LocalVariableName", "PropertyName")
above the class name to suppress naming conventions warnings for global and local variables.
#Suppress("EnumEntryName") use these
Please see Suppress inspections. You are not supposed to type it by hand.
Use Alt+Enter to invoke the pop-up menu for the light bulb, select the inspection or the suggested quick fix from the drop-down menu, press the right arrow on the keyboard to open the sub-menu on the right, choose the Suppress option.
Remark: This question is (up to now) not a duplicate. I know how to disable the hints. This is not what I am looking for.
In intelliJ a feature "hides" parts of my code, e.g. variable declarations as "var" or getter methods like in the example below.
The code shows t.message, but the code behind this visual abbrevation is t.getMessage(). How can I disable that feature and always show t.getMessage()?
Abbreviated code:
Real code:
Because I don't know the name of the feature I have no idea what I am looking for. Any ideas?
To disable showing val/var instead of variable type
go to Settings | Editor | General | Code Folding
and UnCheck Variable Declaration
And just next to it
Uncheck Getters and setters
to start showing getter Setter method calls with full method name
refer- https://stackoverflow.com/a/48271952/3661654
How can I suppress the inspection in Kotlin for an unused variable
val xyz = abc
I get the squiggly line but ALT-ENTER is useless for this, I tried also to create in another method several variables unused and they also lack the ALT-ENTER ability to ignore the warning. Although I have definitely used ALT-ENTER for this in the past, although maybe it was only in java, can't remember.
So I must manually construct it by hand. I've been trying several variations but I can't get anything to work. Please tell me the correct //noinspection or #SupressWarnings to use, thanks
In IntelliJ IDEA, a right-side arrow on an ALT+ENTER context menu (like this: ) means that you can use your arrow keys to navigate further along the menu. In this case, it leads to your answer:
#Suppress("UNUSED_VARIABLE")
val unused = ""
If you do not get the initial context menu (Remove variable '...'), you may have disabled the "Unused assignment" inspection in your current project. You can fix this by going to Settings -> Editor -> Inspections.
Is there a shortcut to quickly show the type of a variable in JetBrains' AppCode? Preferably this would be something akin to Visual Studio, which shows the type of a variable when you hover over it with the mouse.
Alternately, if you hold the command key while hovering, you can hover the variable to have the executive summary info bubble. By then clicking the keyword (not the info-bubble) you can then get 'beamed over' to the code that declares or implements the specific interface. For example, in the following line :
[fa.AoEspec addTileSpec:[AoEtile AoEtileFromString:#"0,0,50,hit"]];
I will get an 'info bubble' for fa (local variable), AoeSpec (a property) AoEtile (a class) AoeTileFromString ... all clickable.
You can press SHIFT-COMMAND I to see the definition of the variable under the cursor. It shows you the line that defines the variable, as well as which file. Pretty handy when looking at code you didn't write.
In AppCode 2.1.x Cmd+Shift+I is not a predefined keyboard shortcut (anymore?!). And the previous mentioned Cmd+MouseOver may not be suitable for keyboard-only-junkies. So here come some alternatives:
Cmd+B - to go to the definition (and Cmd+Alt+CursorLeft to go back)
Alt+Space or Cmd+y - to show the quick definition window [1]
Maybe this is helpful.
[1] In AppCode 2.1.2 there seems to be a bug I filed with JetBrains that the quick definition window is empty for iVars (these underscore variables that are generate by auto-synthesize from #property fields). But in all other cases quick definition window works fine! And maybe the bug is fixed when you read this...
What works for me in AppCode 2018.2 is control + command + ? when the variable is under the cursor (quick documentation under View).
You can see a couple of other useful combinations under the View menu.