Autocomplete does not show the class I just added

I add a class to the project.  Then I go to another class.  I start to type in the name of the class I created, but it does not come up unless I add the import.

What I would like to do is see that class in the autocomplete.  Then when I select it have the import added automatically or using the appcode shortcut.

Is there anyway to do this?  Do I always need the import added before it comes up in autocomplete?

0
4 comments

Hi Mel,

It is definitely correct behavior that you have to add import for using another class methods. Please take a look at the screenshots. Firstly you have created new class NewClass with any method newMethod. After that if you want to use newMethod in the other class AppCode suggests you to import NewClass.
Screen Shot 2013-06-03 at 12.41.56 PM.png
Screen Shot 2013-06-03 at 12.41.46 PM.png

If I didn't catch you idea could you please describe it in the other words with steps

0

Thanks for the reply.

You did catch my idea.

This would work perfectly, but the problem happens when there is a long class name.

I can never type it in correclty and I have to scroll to the class to copy paste it in order to get the import to work.

It would have been nice to have an option to show all classes in the project (last in the autocomplete results) if they were not imported yet.  this way I could be sure that I was typing in the correct class and it could add the import in at the same time.

As a work around I think the import statement has autocomplete to so I can work from there, but it is not as quick.

0

Hi Mel,

From your report I see two ways how to solve this problem. Let's say I've created class with long name 'mainClassIHaveNeverUsedThisLongLongNameAsClassNameBecauseItMadeMeAngry'.
1. The first desicion is to add import before you start using any method of class. In this case you will see autocompletion:
Screen Shot 2013-06-05 at 1.56.24 PM.png
2. The second way is to press Ctrl+Space when you trying to enter your class name in code. If you click on 'mainClassIHave...' in the completion option then the import will be added automatically:
Screen Shot 2013-06-05 at 1.59.10 PM.png

Screen Shot 2013-06-05 at 1.59.21 PM.png

1

Mel,

you can make use of auto-importing completion - when you type class name and get auto-completion popup, it shows only imported classes first; if you press Ctrl+Space, though, the class list will be expanded with not-yet-imported classes and selecting one of them will automatically insert the necessary import.

You can read about more completion tricks in our blog.

0

Please sign in to leave a comment.