Child pages
  • Auto Import of Classes
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

You can write class name without import statements, then editor will highlight this reference as unresolved. Press Alt+Enter to insert appropriate import statement automatically.

To adjust auto-imports for Scala, look at File -> Settings -> Code Style -> Scala -> Imports

Scala language gives you flexible ways to use import statements. You can import not full qualified name or use import statemnt in any code block. Also you can collect few imports in one import statemet without using placeholder. All of these Scala language features we tried to reflect in plugin:

  • As result of auto-import feature, shortest qualified name used for new import statement (you may choose option to use full qualified name). If any short or full qualified name can't be inserted, root qualifier is being added automatically.

    Be Careful

    Icon

    This can produce bugs in plugin. With using placeholder, you automatically import packages. So inserted import can be hidden.

  • All import statements from one package collected in one statement automatically. If classes from one package exceed option, which you set, it replaced by placeholder. You can remove option to stop collecting imports
  • If class name have only one candidate for importing, it can be imported on the fly, without pressing Alt+Enter. To activate this feature, choose appropriate option.
  • You can choose option to insert import statements not only in file header to use local imports.
  • No labels