0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 07:00:59 +01:00
Commit Graph

5 Commits

Author SHA1 Message Date
isaacs
0cdf85e28d Lint all the JavaScripts. 2012-02-18 15:34:57 -08:00
Nathan Rajlich
a118f21728 repl: make tab completion work on non-objects 2012-02-17 15:51:33 +01:00
Bert Belder
892056bf97 tests: fix more lint issues 2012-01-17 20:16:49 +01:00
seebees
3421f43351 .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.
2011-11-12 11:34:55 -08:00
seebees
b00f5e2e14 Tab Compete test for node REPL
Currently the REPL only tab completes for globally scoped variables
2011-11-12 11:34:55 -08:00