goBrowsePackages: toString bug fix + do not wait for goListAll#1136
goBrowsePackages: toString bug fix + do not wait for goListAll#1136ramya-rao-a merged 3 commits intomicrosoft:masterfrom
Conversation
|
@marwan-at-work, |
ramya-rao-a
left a comment
There was a problem hiding this comment.
looks good. I have 2 comments.
src/goBrowsePackage.ts
Outdated
| showPackageFiles(selectedText); | ||
| } | ||
|
|
||
| function showPackageFiles(pkg: string) { |
There was a problem hiding this comment.
if pkg is empty string which can happen when the command is run without any editor open, then we will be needlessly creating a process to run go list
src/goBrowsePackage.ts
Outdated
| } | ||
|
|
||
| function showTryAgainLater() { | ||
| // `go list all` has not completed. Wait for a second which is an acceptable duration of delay. |
There was a problem hiding this comment.
if at the end of this second, go list completes, we won't be showing anything. Was that intended?
There was a problem hiding this comment.
This is so that we don't get stuck in an infinite loop. And since we say try after sometime, it shouldn't be a surprise.
This PR fixes two things:
An error in
goListAll()where we callchunks.toString(). The method puts,'s between every chunk which causes some lines to not be correct imports. I think this is why the auto-import on tab didn't work for all imports (at least for me)Refactored
goBrowsePackagesso that we don't have to wait forgoListAllto finish. This should speed up browsing packages a lot at initial time, especially for users with slower computers and very large GOPATH tree.In
goBrowsePackageswe still need a feature that depends ongoListAll(), which is to show a list of all the packages in your GOPATH to select from. So that logic is still there.