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

Use folder containing go.mod file as cwd when running godef, gogetdoc, go doc #2262

Merged
merged 7 commits into from
Jan 22, 2019

Conversation

ramya-rao-a
Copy link
Contributor

@ramya-rao-a ramya-rao-a commented Jan 20, 2019

Right now, we use the workspace folder as cwd when running godef and gogetdoc for the Go to definition feature.

This might not be performant if the workspace folder is much higher than where the go.mod file is
This might not give accurate results in case of sub modules

Also, when running go doc to get the documentation to show on hover, we don't set any working directory at all. This results in getting no documentation for symbols in the same package.

This PR updates the code that runs godef, gogetdoc and go doc to use the folder corresponding to the right go.mod file as cwd
When operating on files under the module cache, we use the workspace folder as before

Not using the right package import path for packages in module cache, results in no documentation to show on hover for their symbols too. So we update the getCurrentPackage function to return the right import path for such packages.

Fixes #2180, #2244 and possibly #2222

@ramya-rao-a ramya-rao-a changed the title Use folder containing go.mod file as cwd when running godef, gogetdoc Use folder containing go.mod file as cwd when running godef, gogetdoc, go doc Jan 21, 2019
@ramya-rao-a ramya-rao-a merged commit cee927d into microsoft:master Jan 22, 2019
@ramya-rao-a ramya-rao-a deleted the module branch January 22, 2019 02:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant