🎨 Dry up buildTokenizedLineForRow methods on TokenizedBuffer

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2015-02-12 16:40:18 -07:00
committed by Max Brunsfeld
parent 18826f414c
commit b2d322f531

View File

@@ -302,15 +302,9 @@ class TokenizedBuffer extends Model
new TokenizedLine({tokens, tabLength, indentLevel, @invisibles, lineEnding})
buildTokenizedLineForRow: (row, ruleStack) ->
line = @buffer.lineForRow(row)
lineEnding = @buffer.lineEndingForRow(row)
tabLength = @getTabLength()
indentLevel = @indentLevelForRow(row)
{tokens, ruleStack} = @grammar.tokenizeLine(line, ruleStack, row is 0)
new TokenizedLine({tokens, ruleStack, tabLength, lineEnding, indentLevel, @invisibles})
@buildTokenizedLineForRowWithText(row, @buffer.lineForRow(row), ruleStack)
buildTokenizedLineForRowWithText: (row, line) ->
ruleStack = @stackForRow(row - 1)
buildTokenizedLineForRowWithText: (row, line, ruleStack = @stackForRow(row - 1)) ->
lineEnding = @buffer.lineEndingForRow(row)
tabLength = @getTabLength()
indentLevel = @indentLevelForRow(row)