Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Apply edit only if edit exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Sep 29, 2016
1 parent 85b4a05 commit 100d889
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/goImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ export function addImport(arg: string) {
let p = arg ? Promise.resolve(arg) : askUserForImport();
p.then(imp => {
let edit = getTextEditForAddImport(imp);
vscode.window.activeTextEditor.edit(editBuilder => {
editBuilder.insert(edit.range.start, edit.newText);
});
if (edit) {
vscode.window.activeTextEditor.edit(editBuilder => {
editBuilder.insert(edit.range.start, edit.newText);
});
}
});
}

0 comments on commit 100d889

Please sign in to comment.