File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,9 +74,14 @@ export function listPackages(excludeImportedPkgs: boolean = false): Thenable<str
7474 return ;
7575 }
7676
77- let magicVendorString = 'vendor/' ;
77+ let magicVendorString = '/ vendor/' ;
7878 let vendorIndex = pkg . indexOf ( magicVendorString ) ;
79-
79+ if ( vendorIndex === - 1 ) {
80+ magicVendorString = 'vendor/' ;
81+ if ( pkg . startsWith ( magicVendorString ) ) {
82+ vendorIndex = 0 ;
83+ }
84+ }
8085 // Check if current file and the vendor pkg belong to the same root project
8186 // If yes, then vendor pkg can be replaced with its relative path to the "vendor" folder
8287 // If not, then the vendor pkg should not be allowed to be imported.
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider {
218218 let pkgName = index === - 1 ? pkg : pkg . substr ( index + 1 ) ;
219219 // pkgs from gopkg.in will be of the form gopkg.in/user/somepkg.v3
220220 if ( pkg . match ( / g o p k g \. i n \/ .* \. v \d + / ) ) {
221- pkgName = pkgName . substr ( 0 , pkgName . indexOf ( '.v' ) ) ;
221+ pkgName = pkgName . substr ( 0 , pkgName . lastIndexOf ( '.v' ) ) ;
222222 }
223223 return {
224224 name : pkgName ,
You can’t perform that action at this time.
0 commit comments