Apply tslint suggestions, round one

This commit is contained in:
Adolfo Ochagavía 2018-10-07 22:59:02 +02:00
parent 69de7e2fd7
commit 4d62cfccbb
16 changed files with 257 additions and 241 deletions

View file

@ -1,14 +1,14 @@
import { TextEditor } from "vscode";
import { TextDocumentIdentifier } from "vscode-languageclient";
import { TextEditor } from 'vscode';
import { TextDocumentIdentifier } from 'vscode-languageclient';
import { Server } from "../server";
import { Decoration } from "../highlighting";
import { Decoration } from '../highlighting';
import { Server } from '../server';
export async function handle(editor: TextEditor | undefined) {
if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') return
let params: TextDocumentIdentifier = {
uri: editor.document.uri.toString()
}
let decorations = await Server.client.sendRequest<Decoration[]>("m/decorationsRequest", params)
Server.highlighter.setHighlights(editor, decorations)
}
if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') { return; }
const params: TextDocumentIdentifier = {
uri: editor.document.uri.toString(),
};
const decorations = await Server.client.sendRequest<Decoration[]>('m/decorationsRequest', params);
Server.highlighter.setHighlights(editor, decorations);
}

View file

@ -4,16 +4,16 @@ import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTr
export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) {
return (event: vscode.TextDocumentChangeEvent) => {
let doc = event.document
if (doc.languageId != "rust") return
const doc = event.document;
if (doc.languageId != 'rust') { return; }
afterLs(() => {
textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri);
})
}
});
};
}
// We need to order this after LS updates, but there's no API for that.
// Hence, good old setTimeout.
function afterLs(f: () => any) {
setTimeout(f, 10)
setTimeout(f, 10);
}