mirror of
https://github.com/atom/atom.git
synced 2026-02-06 20:55:33 -05:00
18 lines
517 B
CoffeeScript
18 lines
517 B
CoffeeScript
Range = require 'range'
|
|
AceLineCommentAdaptor = require 'ace-line-comment-adaptor'
|
|
|
|
module.exports =
|
|
class LineCommenter
|
|
highlighter: null
|
|
buffer: null
|
|
aceMode: null
|
|
|
|
constructor: (@highlighter) ->
|
|
@buffer = @highlighter.buffer
|
|
@aceMode = @buffer.getMode()
|
|
@adaptor = new AceLineCommentAdaptor(@buffer)
|
|
|
|
toggleLineCommentsInRange: (range) ->
|
|
range = Range.fromObject(range)
|
|
@aceMode.toggleCommentLines(@highlighter.stateForRow(range.start.row), @adaptor, range.start.row, range.end.row)
|