IDEA should ignore word "grails" in begin of command.

This commit is contained in:
Sergey Evdokimov
2011-09-08 18:59:51 +04:00
parent c6b3aa4cd6
commit 0ab9e8b4e3
2 changed files with 9 additions and 1 deletions
@@ -41,6 +41,8 @@ import java.util.List;
public class MvcRunTargetDialog extends DialogWrapper {
private static final String GRAILS_PREFIX = "grails ";
private JPanel contentPane;
private JLabel myTargetLabel;
private JPanel myFakePanel;
@@ -109,6 +111,12 @@ public class MvcRunTargetDialog extends DialogWrapper {
public String[] getTargetArguments() {
String text = getSelectedText();
text = text.trim();
if (text.startsWith(GRAILS_PREFIX)) {
text = text.substring(GRAILS_PREFIX.length());
}
Iterable<String> iterable = StringUtil.tokenize(text, " ");
ArrayList<String> args = new ArrayList<String>();
for (String s : iterable) {
@@ -78,7 +78,7 @@ public class MvcTargetDialogCompletionUtils {
List<LookupElement> res = new ArrayList<LookupElement>();
if (text.substring(0, offset).matches("\\s*(?:(:?-\\S+|dev|prod|test)\\s+)*\\S*")) {
if (text.substring(0, offset).matches("\\s*(grails\\s*)?(?:(:?-\\S+|dev|prod|test)\\s+)*\\S*")) {
// Complete command name because command name is not typed.
for (String completionVariant : getAllTargetNames(module)) {
res.add(TailTypeDecorator.withTail(LookupElementBuilder.create(completionVariant), TailType.SPACE));