Simplify on-demand placeholder line creation and add test coverage

This commit is contained in:
Antonio Scandurra
2016-10-12 12:28:30 +02:00
parent 2246072ac9
commit d393cba75d
3 changed files with 37 additions and 10 deletions

View File

@@ -247,9 +247,6 @@ class LanguageMode
suggestedIndentForLineAtBufferRow: (bufferRow, line, options) ->
tokenizedLine = @editor.tokenizedBuffer.buildTokenizedLineForRowWithText(bufferRow, line)
iterator = tokenizedLine.getTokenIterator()
iterator.next()
scopeDescriptor = new ScopeDescriptor(scopes: iterator.getScopes())
@suggestedIndentForTokenizedLineAtBufferRow(bufferRow, line, tokenizedLine, options)
suggestedIndentForTokenizedLineAtBufferRow: (bufferRow, line, tokenizedLine, options) ->

View File

@@ -269,14 +269,8 @@ class TokenizedBuffer extends Model
else
text = @buffer.lineForRow(bufferRow)
lineEnding = @buffer.lineEndingForRow(bufferRow)
tags = [
@grammar.startIdForScope(@grammar.scopeName),
text.length,
@grammar.endIdForScope(@grammar.scopeName)
]
tags = [@grammar.startIdForScope(@grammar.scopeName), text.length, @grammar.endIdForScope(@grammar.scopeName)]
@tokenizedLines[bufferRow] = new TokenizedLine({openScopes: [], text, tags, lineEnding, @tokenIterator})
else
null
tokenizedLinesForRows: (startRow, endRow) ->
for row in [startRow..endRow] by 1