Package com.google.collide.client.code.autocomplete

Examples of com.google.collide.client.code.autocomplete.DefaultAutocompleteResult


        .replace("%i", indent(lineStart))
        .replace("%d", dedent(lineStart));
    int pos = replaced.indexOf("%c");
    pos = (pos == -1) ? replaced.length() : pos;
    String completion = replaced.replace("%c", "");
    return new DefaultAutocompleteResult(completion, pos, 0, 0, 0, CLOSE, triggeringString);
  }
View Full Code Here


        nextChar == -1 || nextChar == ' ' || nextChar == ',' || nextChar == ';' || nextChar == '\n';

    // TODO: Check if user has just fixed pairing?
    if (context != IN_STRING) {
      if ('(' == key && canPairParenthesis) {
        return new ExplicitAction(new DefaultAutocompleteResult("()", "", 1));
      } else if ('[' == key && canPairParenthesis) {
        return new ExplicitAction(new DefaultAutocompleteResult("[]", "", 1));
      } else if ('{' == key && canPairParenthesis) {
        return new ExplicitAction(new DefaultAutocompleteResult("{}", "", 1));
      } else if ('"' == key || '\'' == key) {
        String doubleQuote = key + "" + key;
        if (!textBeforePosition(selectionRange[0]).endsWith(doubleQuote)) {
          return new ExplicitAction(new DefaultAutocompleteResult(doubleQuote, "", 1));
        }
      } else if (!selection.hasSelection() && (key == nextChar)
          && (']' == key || ')' == key || '}' == key)) {
        // Testing what is more useful: pasting or passing.
        JsonArray<Token> tokens = parser.parseLineSync(selectionRange[0].getLine());
View Full Code Here

    if (selectedProposal.isFunction()) {
      tailOffset = 1;
      name += "()";
    }

    return new DefaultAutocompleteResult(name, triggeringString, name.length() - tailOffset);
  }
View Full Code Here

  private static AutocompleteResult constructResult(String rawResult, String triggeringString) {
    int start = rawResult.indexOf('<');
    int end = rawResult.indexOf('>');
    if ((start >= 0) && (start < end)) {
      return new DefaultAutocompleteResult(
          rawResult, (end + 1), 0, (end + 1) - start, 0, CLOSE, triggeringString);
    }
    return new DefaultAutocompleteResult(rawResult, triggeringString, rawResult.length());
  }
View Full Code Here

      Log.warn(getClass(), "Invocation of this method in not allowed for type CLASS");
      return DefaultAutocompleteResult.EMPTY;
    } else if (PROPERTY == completionType) {
      String addend = name + PROPERTY_SEPARATOR + PROPERTY_TERMINATOR;
      int jumpLength = addend.length() - PROPERTY_TERMINATOR.length();
      return new DefaultAutocompleteResult(
          addend, jumpLength, 0, 0, 0, OPEN, triggeringString);
    } else if (VALUE == completionType) {
      return constructResult(name, triggeringString);
    }
    Log.warn(getClass(), "Invocation of this method in not allowed for type NONE");
View Full Code Here

    lastToken = (CssToken) tokens.peek();
    String context = lastToken.getContext();
    boolean inBlock = context != null && context.endsWith("{");
    if (inBlock && NULL == lastToken.getType()) {
      return new ExplicitAction(
          new DefaultAutocompleteResult(CLASS_SEPARATOR, "", CLASS_JUMPLENGTH));
    }
    return ExplicitAction.DEFAULT;
  }
View Full Code Here

TOP

Related Classes of com.google.collide.client.code.autocomplete.DefaultAutocompleteResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.