This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.load, .save and local scope tab completion
Fixes #2063. REPLServer.prototype.resetContext: Reset the line cache REPLServer.prototype.memory (don't know if I like that name, called from finish) pushes what cmd's have been executed against it into this.lines pushes the "tab depth" for bufferedCommands, in this.lines.level REPLServer.prototype.displayPrompt: Uses "tab depth" from this.lines.level to adjust the prompt to visually denote this depth e.g. > asdf = function () { … var inner = { ….. one:1 REPLServer.prototype.complete: Now notices if there is a bufferedCommand and attempts determine locally scoped variables by removing any functions from this.lines and evaling these lines in a nested REPL e.g. > asdf = function () { … var inner = { one: 1}; … inn\t will complete to 'inner' and inner.o\t will complete to 'inner.one' If the nested REPL still has a bufferedCommand it will falls back to the default. ArrayStream is a helper class for the nested REPL to get commands pushed to it. new REPLServer('', new ArrayStream()); Finally added two new REPL commands .save and .load, each takes 1 parameter, a file and attempts to save or load the file to or from the REPL respectively.
- Loading branch information
Showing
3 changed files
with
237 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters