The auto completion menu usually shows too many suggestions. For example, when typing "Double", there are 10 types with name "Double" popping up, from packages that I never imported.
I know I can exclude certain packages from auto import, but it doesn't solve the problem entirely. Even if I exclude package "java", it still shows types from javafx, sun, org, com, etc. How can I exclude all packages or disable auto import completely?
You can at least disable the completion auto popup:
File (menu) -> Settings -> Editor -> General -> Code Completion -> Autopopup code completion
For me, the automatic popup gets in the way of typing and navigating anyway.
Also, I'd like to enable
Editor -> General -> Auto Import -> Add unambiguous imports on the fly
Then whenever I really need it, I explicitly invoke one of the code completion variants: Ctrl-Space (Basic) or Ctrl-Shift-Space (Type Matching) or Ctrl-Alt-Space (Class name).
Related
I would like that when I write the name of a property and I tab to autocomplete, it put "this" prefix automatically.
For exemple:
If I tab, I get this:
I would like to have this instead:
There are my visual studio settings, Resharper settings and editorConfig:
(Edit: I've opened a feature request: https://developercommunity.visualstudio.com/t/Visual-Studio-2022-auto-prefix-propertie/10221630)
(Edit 2: The language is C#)
This would need to be a feature request. You can submit that through VS with the Suggest A Feature on the feedback menu.
When you press tab to commit the completion item, the text to insert (or "insertion text") for that item has already been calculated. In most cases, it is the text seen (known as the display text), but sometimes the insertion text can be different (or even include edits other places in the document!). There is also the possibility, depending on how each language implements the completion feature, that the language can make additional calculations and edits as part of committing the item.
In either event (pre-computed or computed during commit), the language feature would need to make changes to include the this. prefix as part of the completion commit edit.
A possible alternative to waiting for a new feature would be to write an editor extension that monitors the buffer changes, and when it sees an applicable member inserted without the required this. prefix, it could then trigger its own edit automatically to insert it.
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
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 way to search a project for all uses of some text, without highlighting that text first. I.e. bring up a search interface, and then type in the text I want to find? I'm not seeing how to do this in the Intellij docs.
Note, when I select some text in a file and I do a Search->Find Usages, it responds by giving a little popup "Cannot find usages. Position to an element which usages you wish to find and try again". I get this whether I search on a variable name in a groovy file, or some text in a comment. So for some strange reason, this isn't working at all.
I'm using Intellij Ultimate 10.5 (version 10.5.1)
Thanks for any help or workarounds.
Is Search->Find in Path what you're looking for? (Ctrl-Shift-F on Windows) You can find text in the whole project, a certain directory, or a custom scope.
I was having the exact same problem searching strings in strings.xml but the project wasn't compiled against that file.
So make sure you have compiled against that build variant, module, flavour, etc.
make sure project configuration is allright
File -> Project Structure -> Project -> set correct SDK
File -> Project Structure -> Projects Settings -> Modules -> + -> Import Module -> import your gradle or maven projects
now clear all existing cache
File -> Invalidate Caches
restart Intellij and wait until the indexes are rebuild. Worked for me :)
After installing the new Eclipse Indigo, the outdent does not work anymore when I press shift+tab on a line. Is there any setting which activates this again?
Problem still actual for Eclipse Kepler
in Main Menu -> Window -> Preferences -> PHP -> Formatter -> {your formatter profile} -> Edit -> Identation -> General Settings:
change tab policy to Spaces and indentation size to 4 (or any desired amount).
Source: https://bugs.eclipse.org/bugs/show_bug.cgi?id=210108
Okay, so I am currently using Eclipse Luna Service Release 1a (4.4.1) and I was experiencing this problem too after switching from whitespace tabbing (4 spaces) instead of standard tab spacing.
The problem for me was that the area I was trying to de-tab/outdent/shift-tab (or whatever you want to call it) had a mix of 4xspaces and actual tabs in it.
Check if this is the case for you. If it is, you should do the conversion from one to the other. To do this, highlight everything in the effected area, then CTRL+F and replace all instances of however many spaces you are using, with "\t".
Make sure that the "Regular expressions" flag is checked.
SHIFT+TAB only seems to work correctly if only tabs or only spaces are used for indentation and won't do anything at all if there is a mix.
Also, naturally, ensure that the correct settings are applied for your tab policy in Main Menu -> Window -> Preferences -> PHP -> Formatter -> {your formatter profile} -> Edit -> Identation -> General Settings.
The functionality works fine and as intended for me since I did this. Make sure to restart the IDE as I have observed that it will subtly tend to stick to old tabbing habits in strange ways if you do not.
It may have something to do with the formatter settings (preferences->java->code style->formatter). I've experienced today the same problem on Eclipse Juno and managed to solve it by setting the indentation size to 4 and the tab size to 4 in the indentation tab. It might be worth to give it a go and play with these settings.
For those who none of the other answers worked, just try to install PDT (Php Development Tools). It has the right hot keys for performing this action. I solved this way.