mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Code review fixes
This commit is contained in:
parent
bd904247ba
commit
02f18abc55
2 changed files with 13 additions and 13 deletions
|
@ -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<void> {
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue