   getCurrentLineRange: ->
     row = @editor.getCursor().getBufferRow()
     lineLength = @editor.lineLengthForBufferRow(row)
-    index = @editor.activeEditSession.indexForBufferPosition({row: row, column: 0})
+    index = @editSession.indexForBufferPosition({row: row, column: 0})
     return {
       start: index,
       end: index + lineLength

emmet = require '../vendor/emmet-core'
utils = emmet.require("utils")

module.exports =
  setupContext: (editor) ->
    @editor = editor
    @indentation = @editor.activeEditSession.getTabText()
    emmet.require("resources").setVariable("indentation", @indentation)

    @syntax = @getSyntax()

    row = @editor.getCursor().getBufferRow()
    column = @editor.getCursor().getBufferColumn()

    return @editSession.indexForBufferPosition( {row: row, column: column} )

  # Sets the current caret position.
  setCaretPos: (index) ->
    pos = @editor.bufferPositionForIndex(index)
    @editor.clearSelection()
    @editor.setCursorBufferPosition pos

  # Returns the current line.
  getCurrentLine: ->
    row = @editor.getCursor().getBufferRow()
    return @editSession.lineForBufferRow(row)

  # Replace the editor's content (or part of it, if using `start` to
  # `end` index).
