mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-10-27 03:32:44 +03:00
Adding a ready
promise
This commit is contained in:
parent
815b66c9dd
commit
100ca5a6d7
@ -265,6 +265,8 @@ class WASMTreeSitterLanguageMode {
|
||||
this.grammarForLanguageString = this.grammarForLanguageString.bind(this);
|
||||
|
||||
this.parsersByLanguage = new Map();
|
||||
let resolve
|
||||
this.ready = new Promise(r => resolve = r)
|
||||
|
||||
this.grammar.getLanguage().then(lang => {
|
||||
this.rootLanguage = lang;
|
||||
@ -274,21 +276,18 @@ class WASMTreeSitterLanguageMode {
|
||||
// this.localsQuery = lang.query(grammar.localsQuery)
|
||||
}
|
||||
this.grammar = grammar;
|
||||
if (grammar.foldsQuery) {
|
||||
if (grammar.foldsQuery !== undefined) {
|
||||
this.foldsQuery = lang.query(grammar.foldsQuery);
|
||||
}
|
||||
if (grammar.indentsQuery) {
|
||||
if (grammar.indentsQuery !== undefined) {
|
||||
this.indentsQuery = lang.query(grammar.indentsQuery);
|
||||
}
|
||||
return this.getOrCreateParserForLanguage(lang);
|
||||
}).then(parser => {
|
||||
this.rootLanguageLayer
|
||||
.update(null)
|
||||
.then(() => this.emitter.emit('did-tokenize'));
|
||||
|
||||
// const range = buffer.getRange();
|
||||
// this.tree = parser.parse(buffer.getText());
|
||||
// this.emitter.emit('did-change-highlighting', range);
|
||||
.then(() => this.emitter.emit('did-tokenize'))
|
||||
.then(() => resolve(true));
|
||||
});
|
||||
|
||||
// this.readyPromise = parserInitPromise.then(() =>
|
||||
|
Loading…
Reference in New Issue
Block a user