diff options
author | Kirill Bulatov <[email protected]> | 2019-07-25 13:17:37 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2019-07-25 13:43:35 +0100 |
commit | 02f18abc559930e5efec5af1ec4f3a7dbb8b4429 (patch) | |
tree | 99794b1ec98b9fb49c404df74bee5bea3574c33b /editors/code/src/commands/inlay_hints.ts | |
parent | bd904247bad2d213c25c0649ebd5e7a31e97135a (diff) |
Code review fixes
Diffstat (limited to 'editors/code/src/commands/inlay_hints.ts')
-rw-r--r-- | editors/code/src/commands/inlay_hints.ts | 14 |
1 files changed, 7 insertions, 7 deletions
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 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import { | 2 | import { Range, TextDocumentChangeEvent, TextEditor } from 'vscode'; |
3 | Range, | ||
4 | TextDocumentChangeEvent, | ||
5 | TextEditor | ||
6 | } from 'vscode'; | ||
7 | import { TextDocumentIdentifier } from 'vscode-languageclient'; | 3 | import { TextDocumentIdentifier } from 'vscode-languageclient'; |
8 | import { Server } from '../server'; | 4 | import { Server } from '../server'; |
9 | 5 | ||
@@ -29,7 +25,7 @@ export class HintsUpdater { | |||
29 | public async loadHints( | 25 | public async loadHints( |
30 | editor: vscode.TextEditor | undefined | 26 | editor: vscode.TextEditor | undefined |
31 | ): Promise<void> { | 27 | ): Promise<void> { |
32 | if (this.displayHints && editor !== undefined) { | 28 | if (this.displayHints && editor !== undefined && this.isRustDocument(editor.document)) { |
33 | await this.updateDecorationsFromServer( | 29 | await this.updateDecorationsFromServer( |
34 | editor.document.uri.toString(), | 30 | editor.document.uri.toString(), |
35 | editor | 31 | editor |
@@ -61,7 +57,7 @@ export class HintsUpdater { | |||
61 | return; | 57 | return; |
62 | } | 58 | } |
63 | const document = cause == null ? editor.document : cause.document; | 59 | const document = cause == null ? editor.document : cause.document; |
64 | if (document.languageId !== 'rust') { | 60 | if (!this.isRustDocument(document)) { |
65 | return; | 61 | return; |
66 | } | 62 | } |
67 | 63 | ||
@@ -71,6 +67,10 @@ export class HintsUpdater { | |||
71 | ); | 67 | ); |
72 | } | 68 | } |
73 | 69 | ||
70 | private isRustDocument(document: vscode.TextDocument): boolean { | ||
71 | return document && document.languageId === 'rust'; | ||
72 | } | ||
73 | |||
74 | private async updateDecorationsFromServer( | 74 | private async updateDecorationsFromServer( |
75 | documentUri: string, | 75 | documentUri: string, |
76 | editor: TextEditor | 76 | editor: TextEditor |