mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Memoize comment scope selector
This commit is contained in:
@@ -1365,7 +1365,8 @@ class Editor extends Model
|
||||
isBufferRowCommented: (bufferRow) ->
|
||||
if match = @lineTextForBufferRow(bufferRow).match(/\S/)
|
||||
scopes = @tokenForBufferPosition([bufferRow, match.index]).scopes
|
||||
new TextMateScopeSelector('comment.*').matches(scopes)
|
||||
@commentScopeSelector ?= new TextMateScopeSelector('comment.*')
|
||||
@commentScopeSelector.matches(scopes)
|
||||
|
||||
# Public: Toggle line comments for rows intersecting selections.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user