mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
🐎 Cache regexes in getRegexForProperty
This commit is contained in:
parent
3834066c75
commit
60b9cf1270
@ -10,6 +10,7 @@ class LanguageMode
|
||||
# editor - The {TextEditor} to associate with
|
||||
constructor: (@editor, @config) ->
|
||||
{@buffer} = @editor
|
||||
@regexesByPattern = {}
|
||||
|
||||
destroy: ->
|
||||
|
||||
@ -328,7 +329,8 @@ class LanguageMode
|
||||
|
||||
getRegexForProperty: (scopeDescriptor, property) ->
|
||||
if pattern = @config.get(property, scope: scopeDescriptor)
|
||||
new OnigRegExp(pattern)
|
||||
@regexesByPattern[pattern] ?= new OnigRegExp(pattern)
|
||||
@regexesByPattern[pattern]
|
||||
|
||||
increaseIndentRegexForScopeDescriptor: (scopeDescriptor) ->
|
||||
@getRegexForProperty(scopeDescriptor, 'editor.increaseIndentPattern')
|
||||
|
Loading…
Reference in New Issue
Block a user