From b133a3b55c47c666d364bc179595a837168b5ade Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 29 Jul 2019 10:19:35 +0300 Subject: Ignore cancelled inlay hints responses --- editors/code/src/commands/inlay_hints.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'editors') diff --git a/editors/code/src/commands/inlay_hints.ts b/editors/code/src/commands/inlay_hints.ts index 8154af8dc..34f7ccddb 100644 --- a/editors/code/src/commands/inlay_hints.ts +++ b/editors/code/src/commands/inlay_hints.ts @@ -79,12 +79,14 @@ export class HintsUpdater { documentUri: string, editor: TextEditor ): Promise { - 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 { -- cgit v1.2.3 From 4924867b3b4ff3d7b363f6cb62bd236dd8270f24 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 29 Jul 2019 11:19:13 +0300 Subject: Style fixes --- editors/code/src/commands/inlay_hints.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/code/src/commands/inlay_hints.ts b/editors/code/src/commands/inlay_hints.ts index 34f7ccddb..3ba9da48b 100644 --- a/editors/code/src/commands/inlay_hints.ts +++ b/editors/code/src/commands/inlay_hints.ts @@ -85,7 +85,10 @@ export class HintsUpdater { range: hint.range, renderOptions: { after: { contentText: `: ${hint.label}` } } })); - return editor.setDecorations(typeHintDecorationType, newDecorations); + return editor.setDecorations( + typeHintDecorationType, + newDecorations + ); } } -- cgit v1.2.3