Skip to content

Commit

Permalink
Notify user in console when gopkgs returns no packages. Fixes microso…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorejo committed Feb 20, 2018
1 parent c448b82 commit 6de7b29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/goPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type GopkgsDone = (res: Map<string, string>) => void;
let allPkgsCache: Map<string, string>;
let allPkgsLastHit: number;
let gopkgsRunning: boolean = false;
let gopkgsNotified: boolean = false;
let gopkgsSubscriptions: GopkgsDone[] = [];
let cacheTimeout: number = 5000;

Expand Down Expand Up @@ -102,6 +103,10 @@ export function getAllPackages(): Promise<Map<string, string>> {
return getAllPackagesNoCache().then((pkgs) => {
if (!pkgs || pkgs.size === 0) {
console.log('Could not find packages. Ensure `gopkgs -format {{.Name}};{{.ImportPath}}` runs successfully.');
if (!gopkgsNotified) {
vscode.window.showInformationMessage('Could not find packages. Ensure `gopkgs -format {{.Name}};{{.ImportPath}}` runs successfully.');
gopkgsNotified = true;
}
}
allPkgsLastHit = new Date().getTime();
return allPkgsCache = pkgs;
Expand Down

0 comments on commit 6de7b29

Please sign in to comment.