Fix remaining tslint suggestions

This commit is contained in:
Adolfo Ochagavía 2018-10-08 20:18:55 +02:00
parent 4d62cfccbb
commit 62b1b05a0d
15 changed files with 82 additions and 78 deletions

View file

@ -18,7 +18,6 @@ export interface SourceChange {
}
export async function handle(change: SourceChange) {
console.log(`applySOurceChange ${JSON.stringify(change)}`);
const wsEdit = new vscode.WorkspaceEdit();
for (const sourceEdit of change.sourceFileEdits) {
const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri);
@ -28,17 +27,18 @@ export async function handle(change: SourceChange) {
let created;
let moved;
for (const fsEdit of change.fileSystemEdits) {
if (fsEdit.type == 'createFile') {
const uri = vscode.Uri.parse(fsEdit.uri!);
wsEdit.createFile(uri);
created = uri;
} else if (fsEdit.type == 'moveFile') {
const src = vscode.Uri.parse(fsEdit.src!);
const dst = vscode.Uri.parse(fsEdit.dst!);
wsEdit.renameFile(src, dst);
moved = dst;
} else {
console.error(`unknown op: ${JSON.stringify(fsEdit)}`);
switch (fsEdit.type) {
case 'createFile':
const uri = vscode.Uri.parse(fsEdit.uri!);
wsEdit.createFile(uri);
created = uri;
break;
case 'moveFile':
const src = vscode.Uri.parse(fsEdit.src!);
const dst = vscode.Uri.parse(fsEdit.dst!);
wsEdit.renameFile(src, dst);
moved = dst;
break;
}
}
const toOpen = created || moved;
@ -51,7 +51,7 @@ export async function handle(change: SourceChange) {
const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri);
const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position);
const editor = vscode.window.activeTextEditor;
if (!editor || editor.document.uri.toString() != uri.toString()) { return; }
if (!editor || editor.document.uri.toString() !== uri.toString()) { return; }
if (!editor.selection.isEmpty) { return; }
editor!.selection = new vscode.Selection(position, position);
}