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

Notify user in console when gopkgs returns no packages #1528

Merged
merged 3 commits into from
Feb 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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