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

Commit

Permalink
Fixes #647 Strip version from autocompleted pkgs from gopkg.in (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a authored Nov 29, 2016
1 parent 79391b1 commit cb0d2bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/goSuggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,13 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider {
let pkgPromise = listPackages(true).then((pkgs: string[]) => {
this.pkgsList = pkgs.map(pkg => {
let index = pkg.lastIndexOf('/');
let pkgName = index === -1 ? pkg : pkg.substr(index + 1);
// pkgs from gopkg.in will be of the form gopkg.in/user/somepkg.v3
if (pkg.match(/gopkg\.in\/.*\.v\d+/)) {
pkgName = pkgName.substr(0, pkgName.indexOf('.v'));
}
return {
name: index === -1 ? pkg : pkg.substr(index + 1),
name: pkgName,
path: pkg
};
});
Expand Down

0 comments on commit cb0d2bc

Please sign in to comment.