Skip to content

Commit

Permalink
repl: allowing tab completion of an empty line and masking __X
Browse files Browse the repository at this point in the history
reserved helpers from tab completion; fixes jashkenas#1583
  • Loading branch information
michaelficarra committed Aug 8, 2011
1 parent 8182163 commit 13ac722
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 14 additions & 3 deletions lib/coffee-script/repl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/repl.coffee
Expand Up @@ -94,9 +94,11 @@ completeAttribute = (text) ->

# Attempt to autocomplete an in-scope free variable: `one`.
completeVariable = (text) ->
if free = (text.match SIMPLEVAR)?[1]
free = (text.match SIMPLEVAR)?[1]
if free?
vars = Script.runInContext 'Object.getOwnPropertyNames(this)', sandbox
possibilities = vars.concat CoffeeScript.RESERVED
keywords = (r for r in CoffeeScript.RESERVED when r[0..1] isnt '__')
possibilities = vars.concat keywords
completions = getCompletions free, possibilities
[completions, free]

Expand Down

0 comments on commit 13ac722

Please sign in to comment.