3 Integration with Editors and IDEs - Reference Documentation
Authors: Yasuharu NAKANO
Version: 0.3
3 Integration with Editors and IDEs
If the editor which you uses supports for external tools, you can immediately execute the code on the current editor by one action. To do it, you have to set up something.3.1 IntelliJ IDEA
External Tools
- Open Settings dialog from "Preferences" menu.
- Select "External Tools" at left pane.
- Click the below "+" button to show "Edit Tool" dialog:
- Set the fields as follows if shell script is available in your environment:
Field Value Remarks Name Improx: SmartInvoker [sh]
Group Grails
Program /path/to/improxSmartInvoker.sh
Parameters $FilePath$
Working directory $FileDir$
Else:
Field Value Remarks Name Improx: SmartInvoker [Groovy]
Group Grails
Program /path/to/groovyclient
You can use normal groovy
command, but it needs a globalJAVA_HOME
environment variable and your patience.Parameters /path/to/improxSmartInvoker.groovy $FilePath$
using a white space as delimiter Working directory $FileDir$
- Click "OK" button to save.
Keymap
- Open Settings dialog from "Preferences" menu.
- Select "Keymap" at left pane.
- Right-click "External Tools > Grails > Improx: SmartInvoker (which you want)" item at right pane and select "Add Keyboard Shortcut" item:
- Push your favorite key at "First Stroke" field on the "Enter Keyboard Shortcut" dialog:
- Click "OK" button to save.
Try to run
- Open a test class in the editor.
- Push the key which you set, for example,
F9
. - Improx plugin run only the active test file and output the result to "Run" view in real time:
In case of using GroovyServ, you should run groovyserver
command at once in advance.
3.2 Eclipse (STS/GGTS)
External Tools
- Open "External Tools Configurations" dialog from "Run > External Tools > External Tools Configurations..." menu.
- Right click on "Program" item at left pane and select "New" item:
- Set the fields as follows if shell script is available in your environment:
Field Value Remarks Name Grails Improx SmartInvoker [sh]
Location /path/to/improxSmartInvoker.sh
Working Directory ${container_loc}
Arguments ${resource_loc}
Else:
Field Value Remarks Name Grails Improx SmartInvoker [Groovy]
Location /path/to/groovyclient
You can use normal groovy
command, but it needs aJAVA_HOME
environment variable at "Environment" tab and your patience.Working Directory ${container_loc}
Arguments /path/to/improxSmartInvoker.groovy ${resource_loc}
using a white space as delimiter - Click "OK" button to save.
Try to run
- Open a test class in the editor.
- Open "External Tools Configurations" dialog from "Run > External Tools > External Tools Configurations..." menu.
- Select "Grails Improx SmartInvoker (which you want)" item at left pane and click "Run" button.
- Improx plugin run only the active test file and output the result to "Console" view in real time:
In case of using GroovyServ, you should run groovyserver
command at once in advance.
After second time, you can easily run the external tool from the submenu of "Run > External Tools" .
3.3 Sublime Text 2
Build System
- Select "Tools > Build System > New Build System..." menu to open new file.
- Edit as follows and save the file as
Groovy.sublime-build
(inPackages/User
directory as default).
{ "cmd": [ "/path/to/improxSmartInvoker.sh", "$file" ], "file_regex": "\\((.*?):([0-9]*)\\)", "selector": "source.groovy" }
{ "cmd": [ "/path/to/groovyclient", // OR /path/to/groovy "/path/to/improxSmartInvoker.groovy", "$file" ], "file_regex": "\\((.*?):([0-9]*)\\)", "selector": "source.groovy" }
Try to run
- Open a test class in the editor.
- Select "Tools > Build" menu (or push a shortcut key, like
super+b
) - Improx plugin run only the active test file and output the result to Bulid Results pane in real time:
In case of using GroovyServ, you should run groovyserver
command at once in advance.
3.4 Vim + QuickRun
quickrun.vim
- Install quickrun.vim plugin if you hasn't done so. (cf. Invoking Groovy Script Directly on Vim using quickrun.vim and GroovyServ)
- Add the following lines into your
.vimrc
and save.
let g:quickrun_config = {} let g:quickrun_config.groovy = {'command' : '/path/to/improxSmartInvoker.sh', 'cmdopt': ''}
let g:quickrun_config = {} let g:quickrun_config.groovy = {'command' : '/path/to/groovyclient', 'cmdopt': '/path/to/improxSmartInvoker.groovy'}
Try to run
- Open a test class in the editor.
- Execute ex command
:QuickRun
(or type<Leader>
r
.) - Improx plugin run only the active test file and output the result to a buffer after it completely finishes:
In case of using GroovyServ, you should run groovyserver
command at once in advance.