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

Examples of com.google.collide.client.code.autocomplete.codegraph.js.JsIndexUpdater


    tokens7.add(new Token(mode, TokenType.NULL, ")"));
    tokens7.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens7.add(new Token(mode, TokenType.NULL, "{"));
    tokens7.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsIndexUpdater indexUpdater = new JsIndexUpdater();
    indexUpdater.onBeforeParse();

    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens1);
    JsCodeScope aScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(aScope);
    assertEquals("a", aScope.getName());

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens2);
    JsCodeScope dProtoScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(dProtoScope);
    assertEquals("d.prototype", dProtoScope.getName());
    assertTrue(dProtoScope.getParent() == aScope);
    assertEquals("a-d-prototype", JsCodeScope.buildPrefix(dProtoScope).join("-"));

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens3);
    assertTrue(line.getTag(JsIndexUpdater.TAG_SCOPE) == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens4);
    assertFalse(line.getTag(JsIndexUpdater.TAG_SCOPE) == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens5);
    JsCodeScope eScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(eScope);
    assertEquals("e", eScope.getName());
    assertFalse(eScope.getParent() == aScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens6);
    JsCodeScope fScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(fScope);
    assertEquals("f", fScope.getName());
    assertTrue(fScope.getParent() == eScope);

    line = line.getNextLine();
    previousLine = TaggableLineUtil.getPreviousLine(line);
    indexUpdater.onParseLine(previousLine, line, tokens7);
    JsCodeScope namelessScope = line.getTag(JsIndexUpdater.TAG_SCOPE);
    assertNotNull(namelessScope);
    assertNull(namelessScope.getName());
    assertTrue(namelessScope.getParent() == fScope);

    indexUpdater.onAfterParse();
  }
View Full Code Here


    HtmlAutocompleter htmlAutocompleter = HtmlAutocompleter.create(
        cssAutocompleter, jsAutocompleter);
    CodeGraphAutocompleter pyAutocompleter = PyAutocompleter.create(
        cubeClient, limitedContextFilePrefixIndex);
    PyIndexUpdater pyIndexUpdater = new PyIndexUpdater();
    JsIndexUpdater jsIndexUpdater = new JsIndexUpdater();
    return new Autocompleter(editor, popup, localPrefixIndexStorage, htmlAutocompleter,
        cssAutocompleter, jsAutocompleter, pyAutocompleter, pyIndexUpdater, jsIndexUpdater);
  }
View Full Code Here

    MockAutocompleter(Editor editor, final AutocompleteBox popup,
        SkipListStringBag localPrefixIndexStorage, HtmlAutocompleter htmlAutocompleter,
        CssAutocompleter cssAutocompleter, CodeGraphAutocompleter jsAutocompleter,
        CodeGraphAutocompleter pyAutocompleter) {
      super(editor, popup, localPrefixIndexStorage, htmlAutocompleter, cssAutocompleter,
          jsAutocompleter, pyAutocompleter, new PyIndexUpdater(), new JsIndexUpdater());
      this.localPrefixIndexStorage = localPrefixIndexStorage;
      this.htmlAutocompleter = htmlAutocompleter;
      this.cssAutocompleter = cssAutocompleter;
      this.jsAutocompleter = jsAutocompleter;
      this.pyAutocompleter = pyAutocompleter;
View Full Code Here

TOP

Related Classes of com.google.collide.client.code.autocomplete.codegraph.js.JsIndexUpdater

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.