Stop using GrammarRegistry in TextEditor

This commit is contained in:
Max Brunsfeld
2016-07-27 14:09:17 -07:00
parent e6c83521c9
commit 3d796df401
8 changed files with 32 additions and 48 deletions

View File

@@ -1,13 +1,12 @@
module.exports =
class TokenIterator
constructor: ({@grammarRegistry}, line) ->
@reset(line) if line?
constructor: (@tokenizedBuffer) ->
reset: (@line) ->
@index = null
@startColumn = 0
@endColumn = 0
@scopes = @line.openScopes.map (id) => @grammarRegistry.scopeForId(id)
@scopes = @line.openScopes.map (id) => @tokenizedBuffer.grammar.scopeForId(id)
@scopeStarts = @scopes.slice()
@scopeEnds = []
this
@@ -26,7 +25,7 @@ class TokenIterator
while @index < tags.length
tag = tags[@index]
if tag < 0
scope = @grammarRegistry.scopeForId(tag)
scope = @tokenizedBuffer.grammar.scopeForId(tag)
if tag % 2 is 0
if @scopeStarts[@scopeStarts.length - 1] is scope
@scopeStarts.pop()