Package com.google.collide.shared.document

Examples of com.google.collide.shared.document.Position


  }

  @Override
  public void onParseLine(Line line, int lineNumber, JsonArray<Token> tokens) {
    ParseResult<XmlState> parserState =
        parser.getState(XmlState.class, new Position(new LineInfo(line, lineNumber), 0), null);
    if (parserState != null && parserState.getState() != null
        && parserState.getState().getContext() != null
        && "a".equalsIgnoreCase(parserState.getState().getContext().getTagName())) {
      inAnchorTag = true;
    }
View Full Code Here


   * @param isThisContext flag indicating "this."-like previous context
   * @return produced proposals (for deeper analysis)
   */
  private JsonArray<AutocompleteProposal> checkProposals(ScopeTrieBuilder builder,
      String[] expected, String triggeringString, boolean isThisContext) {
    Position cursor = new Position(
        Document.createEmpty().getFirstLineInfo(), triggeringString.length());
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();
    CompletionContext<State> context = new CompletionContext<State>(
        "", triggeringString, isThisContext, CompletionType.GLOBAL, null, 0);
    JsonArray<AutocompleteProposal> proposals = proposalBuilder.doGetProposals(
View Full Code Here

    checkProposals(builder, new String[0], "", true);
  }

  public void testLexicalScopeCompletionIncludesAncestorScopesAndChildScopes() {
    ScopeTrieBuilder builder = setupBuilder();
    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), 82);
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();
    CompletionContext<State> context = new CompletionContext<State>(
        "", "", false, CompletionType.GLOBAL, null, 0);
    JsonArray<AutocompleteProposal> proposals = proposalBuilder.doGetProposals(
        context, cursor, builder);
View Full Code Here

  }

  public void testCaseInsensitiveSearch() {
    assertTrue(Autocompleter.CASE_INSENSITIVE);
    ScopeTrieBuilder builder = setupBuilder();
    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), 82);
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();
    CompletionContext<State> context = new CompletionContext<State>(
        "", "MEtH", false, CompletionType.GLOBAL, null, 0);
    JsonArray<AutocompleteProposal> proposals = proposalBuilder.doGetProposals(
        context, cursor, builder);
View Full Code Here

    assertEquals(expected, TestUtils.createNameSet(proposals));
  }

  public void testThisCompletionIncludesDirectParentScope() {
    ScopeTrieBuilder builder = setupBuilder();
    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), 86);
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();
    CompletionContext<State> context = new CompletionContext<State>(
        "", "", true, CompletionType.PROPERTY, null, 0);
    JsonArray<AutocompleteProposal> proposals = proposalBuilder.doGetProposals(
        context, cursor, builder);
View Full Code Here

    ScopeTrieBuilder builder = setupBuilder();
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();
    CompletionContext<State> context = new CompletionContext<State>(
        "", "", true, CompletionType.PROPERTY, null, 0);

    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), LAST_COLUMN + 1);
    assertFalse(proposalBuilder.doGetProposals(context, cursor, builder).isEmpty());

    cursor = new Position(Document.createEmpty().getFirstLineInfo(), LAST_COLUMN + 2);
    assertTrue(proposalBuilder.doGetProposals(context, cursor, builder).isEmpty());
  }
View Full Code Here

    String previousContext = "moo.";
    CompletionContext<State> context = new CompletionContext<State>(
        previousContext, "", false, CompletionType.PROPERTY, null, 0);

    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), 1);
    JsoStringSet prefixes = scopeTrieBuilder.calculateScopePrefixes(context, cursor);

    assertNotNull(prefixes);
    assertFalse(prefixes.isEmpty());
    assertTrue(prefixes.contains(previousContext));
View Full Code Here

    String previousContext = "moo.";
    CompletionContext<State> context = new CompletionContext<State>(
        previousContext, "", false, CompletionType.PROPERTY, null, 0);

    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), 20);
    JsoStringSet prefixes = builder.calculateScopePrefixes(context, cursor);

    assertNotNull(prefixes);
    assertFalse(prefixes.isEmpty());
    assertTrue(prefixes.contains(OBJECT_1 + "." + METHOD_1 + "." + previousContext));
View Full Code Here

    ScopeTrieBuilder builder = setupBuilder();
    ProposalBuilder<State> proposalBuilder = new MockProposalBuilder();

    CompletionContext<State> context = new CompletionContext<State>(
        "", "", true, CompletionType.PROPERTY, null, 0);
    Position cursor = new Position(Document.createEmpty().getFirstLineInfo(), LAST_COLUMN + 2);
    assertTrue(proposalBuilder.doGetProposals(context, cursor, builder).isEmpty());

    context = new CompletionContext<State>(
        OBJECT_1 + ".", "", true, CompletionType.PROPERTY, null, 0);
    cursor = new Position(Document.createEmpty().getFirstLineInfo(), LAST_COLUMN + 2);
    assertFalse(proposalBuilder.doGetProposals(context, cursor, builder).isEmpty());
  }
View Full Code Here

    /*
     * There can theoretically be multiple text changes, but we just set
     * selection to the first
     */
    TextChange textChange = textChanges.get(0);
    Position endPosition =
        new Position(new LineInfo(textChange.getEndLine(), textChange.getEndLineNumber()),
            textChange.getEndColumn());
    if (textChange.getType() == TextChange.Type.INSERT) {
      endPosition = PositionUtils.getPosition(endPosition, 1);
    }

    selection.setSelection(new LineInfo(textChange.getLine(), textChange.getLineNumber()),
        textChange.getColumn(), endPosition.getLineInfo(),
        endPosition.getColumn());
  }
View Full Code Here

TOP

Related Classes of com.google.collide.shared.document.Position

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.