Bring back version check to avoid flickering caused by coordinates conversion

This commit is contained in:
Alex Dima 2020-01-21 09:11:34 +01:00
parent 79253d4cb1
commit fbc1c189ff
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0

View file

@ -68,11 +68,21 @@ class DocumentSemanticTokensProvider implements vscode.DocumentSemanticTokensPro
return null;
}
const versionBeforeRequest = document.version;
const response = await (this.client as ExperimentalProtocol.IExtendedTypeScriptServiceClient).execute('encodedSemanticClassifications-full', requestArg, token);
if (response.type !== 'response' || !response.body) {
return null;
}
const versionAfterRequest = document.version;
if (versionBeforeRequest !== versionAfterRequest) {
// cannot convert result's offsets to (line;col) values correctly
// a new request will come in soon...
return null;
}
const tokenSpan = response.body.spans;
const builder = new vscode.SemanticTokensBuilder();