     commentStartRegex = new OnigRegExp("^(\\s*)(#{commentStartRegexString})")
 
     if commentEndString
-      shouldUncomment = commentStartRegex.test(buffer.lineForRow(start))
+      shouldUncomment = commentStartRegex.testSync(buffer.lineForRow(start))
       if shouldUncomment
         commentEndRegexString = _.escapeRegExp(commentEndString).replace(/^(\s+)/, '(?:$1)?')
         commentEndRegex = new OnigRegExp("(#{commentEndRegexString})(\\s*)$")
-        startMatch =  commentStartRegex.search(buffer.lineForRow(start))
-        endMatch = commentEndRegex.search(buffer.lineForRow(end))
+        startMatch =  commentStartRegex.searchSync(buffer.lineForRow(start))
+        endMatch = commentEndRegex.searchSync(buffer.lineForRow(end))
         if startMatch and endMatch
           buffer.transact ->
             columnStart = startMatch[1].length


    precedingLine = @buffer.lineForRow(precedingRow)
    desiredIndentLevel = @editor.indentationForBufferRow(precedingRow)
    desiredIndentLevel += 1 if increaseIndentRegex.test(precedingLine) and not @editor.isBufferRowCommented(precedingRow)

    return desiredIndentLevel unless decreaseIndentRegex = @decreaseIndentRegexForScopes(scopes)
    desiredIndentLevel -= 1 if decreaseIndentRegex.test(currentLine)

    Math.max(desiredIndentLevel, 0)



      if shouldUncomment
        for row in [start..end]
          if match = commentStartRegex.searchSync(buffer.lineForRow(row))
            columnStart = match[1].length
            columnEnd = columnStart + match[2].length
            buffer.setTextInRange([[row, columnStart], [row, columnEnd]], "")
