From 02f18abc559930e5efec5af1ec4f3a7dbb8b4429 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 25 Jul 2019 15:17:37 +0300 Subject: Code review fixes --- editors/code/src/commands/inlay_hints.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'editors/code/src/commands') diff --git a/editors/code/src/commands/inlay_hints.ts b/editors/code/src/commands/inlay_hints.ts index 0ce3edcbf..ba9966161 100644 --- a/editors/code/src/commands/inlay_hints.ts +++ b/editors/code/src/commands/inlay_hints.ts @@ -1,9 +1,5 @@ import * as vscode from 'vscode'; -import { - Range, - TextDocumentChangeEvent, - TextEditor -} from 'vscode'; +import { Range, TextDocumentChangeEvent, TextEditor } from 'vscode'; import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; @@ -29,7 +25,7 @@ export class HintsUpdater { public async loadHints( editor: vscode.TextEditor | undefined ): Promise { - if (this.displayHints && editor !== undefined) { + if (this.displayHints && editor !== undefined && this.isRustDocument(editor.document)) { await this.updateDecorationsFromServer( editor.document.uri.toString(), editor @@ -61,7 +57,7 @@ export class HintsUpdater { return; } const document = cause == null ? editor.document : cause.document; - if (document.languageId !== 'rust') { + if (!this.isRustDocument(document)) { return; } @@ -71,6 +67,10 @@ export class HintsUpdater { ); } + private isRustDocument(document: vscode.TextDocument): boolean { + return document && document.languageId === 'rust'; + } + private async updateDecorationsFromServer( documentUri: string, editor: TextEditor -- cgit v1.2.3