     for a in tag.getElementsByTagName 'a'
       a.remove()
     graphite_function_docs[tag.id[prefix_length..]] = tag.parentNode
+
+token_after = (cm, token, line) ->
+  t = token
+  last_interesting_token = null
+  loop
+    next_token = cm.getTokenAt CodeMirror.Pos(line, t.end + 1)
+    if t.start == next_token.start
+      break
+    if next_token.type?
+      last_interesting_token = next_token
+    t = next_token
+  last_interesting_token
 
 suggest = (cm, showHints, options) ->
   cur = cm.getCursor()

    for k of graphite_function_docs
      if k.indexOf(s) is 0
        list.push k
    showHints
      list: list
      from: CodeMirror.Pos cur.line, token.start

  CodeMirror.commands.contextHelp = (cm) ->
    cur = editor.getCursor()
    token = cm.getTokenAt(cur)
    if has_docs token.string
      run "docs '#{token.string}'"
    else if create_ns()[token.string]?
      run "help #{token.string}"

