Ignore cancelled inlay hints responses

This commit is contained in:
Kirill Bulatov 2019-07-29 10:19:35 +03:00
parent de278d1649
commit b133a3b55c

View File

@ -79,12 +79,14 @@ export class HintsUpdater {
documentUri: string,
editor: TextEditor
): Promise<void> {
const newHints = (await this.queryHints(documentUri)) || [];
const newDecorations = newHints.map(hint => ({
range: hint.range,
renderOptions: { after: { contentText: `: ${hint.label}` } }
}));
return editor.setDecorations(typeHintDecorationType, newDecorations);
const newHints = await this.queryHints(documentUri);
if (newHints != null) {
const newDecorations = newHints.map(hint => ({
range: hint.range,
renderOptions: { after: { contentText: `: ${hint.label}` } }
}));
return editor.setDecorations(typeHintDecorationType, newDecorations);
}
}
private async queryHints(documentUri: string): Promise<InlayHint[] | null> {