Revert "Revert "Merge pull request #19060 from atom/mb-tree-sitter-0-14""

This reverts commit f861d89fd3.
This commit is contained in:
Max Brunsfeld
2019-04-15 09:58:23 -07:00
parent 7c6b614b92
commit 8f44daf4ee
4 changed files with 12 additions and 42 deletions

View File

@@ -24,7 +24,7 @@ class TreeSitterLanguageMode {
}
}
constructor ({buffer, grammar, config, grammars, syncOperationLimit}) {
constructor ({buffer, grammar, config, grammars, syncTimeoutMicros}) {
TreeSitterLanguageMode._patchSyntaxNode()
this.id = nextId++
this.buffer = buffer
@@ -35,8 +35,8 @@ class TreeSitterLanguageMode {
this.rootLanguageLayer = new LanguageLayer(this, grammar)
this.injectionsMarkerLayer = buffer.addMarkerLayer()
if (syncOperationLimit != null) {
this.syncOperationLimit = syncOperationLimit
if (syncTimeoutMicros != null) {
this.syncTimeoutMicros = syncTimeoutMicros
}
this.rootScopeDescriptor = new ScopeDescriptor({scopes: [this.grammar.scopeName]})
@@ -111,7 +111,7 @@ class TreeSitterLanguageMode {
const parser = PARSER_POOL.pop() || new Parser()
parser.setLanguage(language)
const result = parser.parseTextBuffer(this.buffer.buffer, oldTree, {
syncOperationLimit: this.syncOperationLimit,
syncTimeoutMicros: this.syncTimeoutMicros,
includedRanges: ranges
})
@@ -1225,6 +1225,6 @@ function hasMatchingFoldSpec (specs, node) {
})
TreeSitterLanguageMode.LanguageLayer = LanguageLayer
TreeSitterLanguageMode.prototype.syncOperationLimit = 1000
TreeSitterLanguageMode.prototype.syncTimeoutMicros = 1000
module.exports = TreeSitterLanguageMode