srecord noeq LeftArrowScriptAutoCompleter(GazelleV_LeftArrowScriptParser parser) { LS tok; CharInToken cursor; S typedCharacters; void seek(S text, int iChar) { parser.setText(text); parser.init(); tok = parser.tok; cursor = charIndexToCharInToken(tok, iChar-1); typedCharacters = takeFirst(cursor.token(), cursor.iChar+1); } S prevToken() { ret get(tok, cursor.iTok-2); } bool beginningOfCmd() { ret eqOneOf(prevToken(), ";", "{", "}") || containsNewLine(get(tok, cursor.iTok-1)); } Cl getCompletions() { ret searcher()!; } ScoredStringSearcher searcher() { ScoredStringSearcher searcher = new(typedCharacters); S prev = prevToken(); if (!beginningOfCmd() && isIdentifier(prev)) searcher.addAll("true", "false", "null"); else searcher.addAll(globalMethodNames()); ret searcher; } swappable Cl globalMethodNames() { ret concatMap methodNames(parser.functionContainers); } }