Package com.google.collide.shared.document

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


  public void testMatchUpDifferentLines() {
    final ImmutableList<String> documentText =
        ImmutableList.of("var list = ['str1',", "    'str2',", "    'str3']");
    customSetUp(documentText);
    LineInfo startLineInfo = document.getLastLineInfo();
    Line matchLine = document.getFirstLine();

    // should find the match on line 1, column 11
    expect(
        mockAnchorManager.createAnchor(EasyMock.eq(ParenMatchHighlighter.MATCH_ANCHOR_TYPE),
            EasyMock.eq(matchLine), EasyMock.eq(0), EasyMock.eq(11))).andReturn(null);
View Full Code Here


   */
  public void testMatchWithFalseMatches() {
    final ImmutableList<String> documentText =
        ImmutableList.of("var list = ['str1',", "'str2',", "   ['sub1','sub2'],", "   'str3']");
    customSetUp(documentText);
    Line startLine = document.getFirstLine();
    Line matchLine = document.getLastLine();

    // should find match on line 4, column 11
    expect(
        mockAnchorManager.createAnchor(EasyMock.eq(ParenMatchHighlighter.MATCH_ANCHOR_TYPE),
            EasyMock.eq(matchLine), EasyMock.eq(4), EasyMock.eq(9))).andReturn(null);
View Full Code Here

    assertSize(3, op);
    assertRetainLine(3, op, 0);
    assertInsert("A", op, 1);
    assertRetain(1, false, op, 2);

    Line line = doc.getLastLine().getPreviousLine();
    textChange =
        TextChange.createInsertion(line, doc.getLastLineNumber() - 1, 0, line,
            doc.getLastLineNumber() - 1, "S");
    op = DocOpUtils.createFromTextChange(factory, textChange);
    assertSize(4, op);
    assertRetainLine(2, op, 0);
    assertInsert("S", op, 1);
    assertRetain(line.getText().length() - 1, true, op, 2);
    assertRetainLine(1, op, 3);
  }
View Full Code Here

  }

  public JsoStringSet calculateScopePrefixes(CompletionContext context, Position cursor) {
    JsoStringSet result = JsoStringSet.create();
    boolean isThisContext = context.isThisContext();
    Line line = cursor.getLine();

    if (!isThisContext) {
      result.add(context.getPreviousContext());
    }

    //PY specific.
    PyCodeScope pyScope = line.getTag(PyIndexUpdater.TAG_SCOPE);
    if (pyScope != null) {
      JsonArray<String> path = PyCodeScope.buildPrefix(pyScope);
      if (isThisContext && pyScope.getType() == PyCodeScope.Type.DEF && path.size() > 1) {
        addThisPrefixes(result, path);
      } else {
        addLexicalPrefixes(result, path, context.getPreviousContext());
      }
      return result;
    }

    // Fallback - use pre-calculated results (valid at the end of line).
    JsCodeScope jsScope = line.getTag(JsIndexUpdater.TAG_SCOPE);

    @SuppressWarnings("unchecked")
    // Trying to get results up to cursor position.
    ParseResult<State> parseResult = context.getParseResult();
    if (parseResult != null) {
View Full Code Here

   *
   * TODO: take care of quoted '{' and '}'
   */
  @VisibleForTesting
  CssCompletionQuery updateOrCreateQuery(CssCompletionQuery completionQuery, Position cursor) {
    Line line = cursor.getLine();
    int column = cursor.getColumn();
    Line lineWithCursor = line;
    boolean parsingLineWithCursor = true;

    /*
     * textSoFar will contain the text of the CSS rule (only the stuff within
     * the curly braces). If we are not in an open rule, return false
View Full Code Here

TOP

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

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.