   last_interesting_token
 
 collect_string_suggestions = (ctx, string) ->
-  Q.all(_.flatten _.map context.collect_extension_points(ctx, 'suggest_strings'), (fn) -> fn string)
+  Q.all(_.flatten _.map Context.collect_extension_points(ctx, 'suggest_strings'), (fn) -> fn string)
   .then (suggestions) -> _.flatten suggestions
 
 collect_key_suggestions = (ctx, string) ->
-  _.flatten _.map context.collect_extension_points(ctx, 'suggest_keys'), (fn) -> fn string
+  _.flatten _.map Context.collect_extension_points(ctx, 'suggest_keys'), (fn) -> fn string
 
 follow_path = (o, path) ->
   result = o

require 'codemirror/mode/coffeescript/coffeescript'
require 'codemirror/addon/hint/show-hint'

context = require './context'
notebook = require './notebook'

create_editor = (target) ->
  if is_nodejs?


commands =
  run: cmd 'Runs the contents of the cell and advances the cursor to the next cell', (cm) ->
    Notebook.run cm.lead_cell, advance: true

  run_in_place: cmd 'Runs the contents of the cell and keeps the cursor in the cell', (cm) ->
    Notebook.run cm.lead_cell, advance: false

  context_help: cmd 'Shows help for the token under the cursor', (cm) ->
    cur = cm.getCursor()
    token = cm.getTokenAt(cur)
    Notebook.context_help cm.lead_cell, token.string

  suggest: cmd 'Suggests a function or metric', (cm) ->
    CodeMirror.showHint cm, suggest, async: true

  fill_with_last_value: cmd 'Replaces the cell with the contents of the previous cell', (cm) ->
    cell = Notebook.input_cell_at_offset cm.lead_cell, -1
    if cell?
      set_value cm, Notebook.cell_value cell
    else
      CodeMirror.Pass

  next_cell: cmd 'Moves the cursor to the next cell', (cm) ->
    unless Notebook.move_focus cm.lead_cell, 1
      CodeMirror.Pass

  previous_cell: cmd 'Moves the cursor to the previous cell', (cm) ->
    unless Notebook.move_focus cm.lead_cell, -1
      CodeMirror.Pass

  maybe_next_cell: cmd 'Moves the cursor to the next cell if the cursor is at the end', (cm) ->
