I'm using Intellij IDEA 2017.1.2 on MacOS High Sierra and the situation is when I type OPTION+ENTER it recommends me to import a class,Auto imports for all classes work well except for HashMap. For example, the class HashTable in the java.util package can auto complete.
I don't know what I had click or checked so how can I fix this problem?
See Preferences > Editor > General > Auto Import > Exclude from Import and Completion.
Here's a screenshot:
With this exclusion in place IntelliJ will not offer java.util.HashMap as an auto import option.
If you remove this exclusion IntelliJ will resume offering java.util.HashMap as an auto import option.
Related
I am trying to use the virtual robot simulator designed by team Beta#8397 and got the simulator working. Now I am trying to put my teams code in so that we can test it. I am getting a bunch of errors that I'm pretty sure all stem from one error that some of the imports aren't importing. Also, my teams code builds fine when not combined with the simulator. I'm not amazing a java, but do know how most of my teams code works. Here is the code for the imports
package org.firstinspires.ftc.teamcode.Robovines;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.robot.Robot;
import com.qualcomm.robotcore.util.Hardware;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.Range;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DigitalChannel;
The errors are on lines 4,5 and 13 with the package being the first line. On line 4 the error is that com.qualcomm.robotcore.robot.Robot does not exist. On lines 5 and 13 the error is that symbol "Hardware" and "DigitalChannel" respectively cannot be found.
Here is the whole project
#BookNinja S : The link you provided doesn't take me to your code.
The virtual robot simulator provides a subset of the functionality of the FTC SDK.
That subset has increased over time, but as commented by #CrazyCoder, the Controller module does not include the com.qualcomm.robotcore.robot.Robot, com.qualcomm.robotcore.util.Hardware, or com.qualcomm.robotcore.hardware.DigitalChannel classes.
With regard to DigitalChannel, this type of sensor is not part of the virtual robot functionality. But, it would be easy to add a dummy DigitalChannel class to the controller (so, getState would always return false, and setState would do nothing).
Dummy classes could probably be used for Hardware and Robot as well, but that would depend upon how you are using those classes in your op modes.
If you submit this as an issue on the virtual_robot github repository, with a link to your project or an explanation of how you are using the Hardware and Robot classes, we (ftc team Beta 8397) can probably add the needed functionality to the virtual_robot project.
My team members and me often face the problem in Intellij that we cannot import some classes via Alt+Enter because Intellij hasn't indexed them successfully.
Our set up
We have different Flutter projects which belong and work together.
ProjectFolder:
our_project/customer_app
our_project/provider_app
our_project/server_app
our_project/model_app
Some of these projects have dependencies to other projects which are declared in the pubspec.yaml file.
Problem
E.g. the customer_app has a dependency to the model_app.
Now we add this new class in model_app such as class MyModel.
Later in the process we want to use MyModel inside of the customer_app.
If we type something like MyModel() and try to press Alt+Enter it doesn't find the class immediately. (it works miracously only sometimes)
What we have to do then is to copy the path of MyModel and do the import manually. Which is often time consuming.
We even tried to run flutter packages get which also doesn't help to find this import of MyModel. Ideally we want that Intellij find the import automatically by indexing it without copying the path out of the other project.
This is a known issue and planned to be fixed eventually.
You can upvote https://github.com/dart-lang/sdk/issues/25820
I have an enum class with a ton of enums, which I like to address as
Enumclass.argument1
Enumclass.argument2
Enumclass.argument3
I had a ton of such references in a file, however IntelliJ decided to put import statements at the top:
import static com.abc.util.Enumclass.argument1;
import static com.abc.util.Enumclass.argument2;
import static com.abc.util.Enumclass.argument3;
and change the references to just
argument1
argument2
argument3
I want to disable this, and also revert what it did. I've been digging around but I just can't find where to do this! I'm on MAC OSX, IJ 12.1.4.
Found it. Hit Alt+Enter on the enum to bring up the options menu, and the first item should say Expand static import to Enumclass.argument1. Press Enter, then chose to do it for all occurrences of that argument1.
How can I exclude some classes from autocomplete, but not from project?
I'm trying to develop on flash with starling library. The problem is that IDE always suggest me a built-in classes, which I probably don't want to use, even if I import another class.
http://monosnap.com/image/7VRQpIhqIPRK2wgBKp41GOU9i
I'm tried to exclude in a Settings -> Editor -> Auto Import, but it takes no effect on a autocomplete.
May be I can reorder autocomplete suggest, for placing the libraries classes on top?
I'm using idea 12.0.4
Does Settings -> Editor -> Auto Import -> Exclude from Import and Completion help you?
Now in Preferences | Editor | General | Auto Import
There are instructions at https://www.jetbrains.com/help/idea/auto-completing-code.html for disabling, but they didn't work for me until invalidating caches and restarting.
Pull up autocomplete, highlight the offending item, then option-return and exclude it, either at the class or method level. Then invalidate caches and restart.
I'm working with intelliJ and my problem is when I start to import some temporary unused packages into my class file intellij delete those line within a second.
how can I turn off this not so nice feature?
Disable File | Settings | Editor | General | Auto Import | Optimize imports on the fly.
Normally you don't need to add imports manually, IDEA does it for you.
For Scala developers: you can have enabled
Settings > Editor > General > Auto Import > Optimize imports on the fly
but add exclusions into
Settings > Editor > Code Style > Scala > Imports always marked as used:
In Intellij 14 :
Settings > Editor > General > Auto Import > Optimize imports on the fly.
(Update)
For the Scala developers out there, you can have 1/2 the cake and eat the other 1/2 now: disable the auto-optimize for just scala
For me while using Go, this was caused by optimizing imports on save. IntelliJ IDEA -> Prefernces -> Tools -> Actions on Save -> Optimize imports.
The above answers are obviously the way to go. Here's another quick fix (a bad one at that) is to simply use it somewhere in your code
if (0) console.log(LibraryName.version);
This should only be a temporary measure though.