Fix request position of the inlay hints

Fixes #129134

The document may change between the request and when `ensureConfigurationForDocument` completes

I think this should fix the shifting around
This commit is contained in:
Matt Bierner
2021-07-22 17:52:59 -07:00
parent 50ac52ca92
commit 847a6d8cd0

View File

@@ -117,11 +117,11 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
return [];
}
await this.fileConfigurationManager.ensureConfigurationForDocument(model, token);
const start = model.offsetAt(range.start);
const length = model.offsetAt(range.end) - start;
await this.fileConfigurationManager.ensureConfigurationForDocument(model, token);
const response = await (this.client as ExperimentalProto.IExtendedTypeScriptServiceClient).execute('provideInlayHints', { file: filepath, start, length }, token);
if (response.type !== 'response' || !response.success || !response.body) {
return [];