ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Groovy Imports

by carwinz ST2

A Sublime Text 2 plugin for inserting import statements into groovy code

Labels groovy, grails

Details

Installs

  • Total 547
  • Win 254
  • OS X 193
  • Linux 100
Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7
Windows 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

A Sublime Text 2 plugin for inserting import statements into groovy code

No setup is required. The plugin finds possible imports:

  • By looking through other classes in the same project
  • By looking at imports in other classes in the same project
  • It is unaware of imports in libraries or the jdk, but you can make the plugin aware of common ones by adding a custom import (see: Tools > Groovy Imports > Edit custom imports)

Most people don't want their imports re-organized automatically, so the plugin attempts to insert new imports near similar ones. (But there is some scope for improvement here).

How to install

With Package Control:

  1. Run “Package Control: Install Package” command, find and install the “Groovy Imports” plugin.

Manually:

  1. Clone the git repo (https://github.com/carwinz/groovy-sublime-imports) into your packages folder (in ST, Preferences > Browse Packages… menu item to open this folder)

Usage

By default, imports will be automatically added when groovy files are saved, however you can turn this off in the config.

The default shortcut is Ctrl+Shift+Alt+i. Or use Go to Tools > Groovy Imports > Add imports

Future Development

  • The order that the imports are added needs some more tweaking
  • Support for wildcard imports (e.g. “some.package.*”)
  • If multiple options exist, pop up a dialog to select one
  • If a classname is used in a string, don't import it