Allow some synchronous parsing to avoid unnecessary re-renders

This commit is contained in:
Max Brunsfeld
2018-05-23 15:58:33 -07:00
parent 7a2667406b
commit 53dfa83ae9
2 changed files with 4 additions and 2 deletions

View File

@@ -72,7 +72,7 @@
"sinon": "1.17.4",
"temp": "^0.8.3",
"text-buffer": "13.14.3",
"tree-sitter": "0.12.5",
"tree-sitter": "0.12.6",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.6",
"winreg": "^1.2.1",

View File

@@ -76,7 +76,9 @@ class TreeSitterLanguageMode {
}
async reparse () {
const tree = await this.parser.parseTextBuffer(this.buffer.buffer, this.tree)
const tree = await this.parser.parseTextBuffer(this.buffer.buffer, this.tree, {
syncOperationLimit: 1000
})
const invalidatedRanges = this.tree.getChangedRanges(tree)
for (let i = 0, n = invalidatedRanges.length; i < n; i++) {