Merge pull request #15977 from atom/mb-use-language-modes

Move `toggleLineComments` method from TokenizedBuffer to TextEditor
This commit is contained in:
Max Brunsfeld
2017-10-24 16:03:21 -07:00
committed by GitHub
6 changed files with 420 additions and 403 deletions

View File

@@ -9,6 +9,8 @@ TokenizedBuffer = require './tokenized-buffer'
Cursor = require './cursor'
Model = require './model'
Selection = require './selection'
TextEditorUtils = require './text-editor-utils'
TextMateScopeSelector = require('first-mate').ScopeSelector
GutterContainer = require './gutter-container'
TextEditorComponent = null
@@ -123,6 +125,8 @@ class TextEditor extends Model
Object.defineProperty(@prototype, 'languageMode', get: -> @tokenizedBuffer)
Object.assign(@prototype, TextEditorUtils)
@deserialize: (state, atomEnvironment) ->
# TODO: Return null on version mismatch when 1.8.0 has been out for a while
if state.version isnt @prototype.serializationVersion and state.displayBuffer?
@@ -3622,9 +3626,6 @@ class TextEditor extends Model
getNonWordCharacters: (scopes) ->
@scopedSettingsDelegate?.getNonWordCharacters?(scopes) ? @nonWordCharacters
getCommentStrings: (scopes) ->
@scopedSettingsDelegate?.getCommentStrings?(scopes)
###
Section: Event Handlers
###
@@ -3887,8 +3888,6 @@ class TextEditor extends Model
toggleLineCommentForBufferRow: (row) -> @toggleLineCommentsForBufferRows(row, row)
toggleLineCommentsForBufferRows: (start, end) -> @tokenizedBuffer.toggleLineCommentsForBufferRows(start, end)
rowRangeForParagraphAtBufferRow: (bufferRow) ->
return unless NON_WHITESPACE_REGEXP.test(@lineTextForBufferRow(bufferRow))