Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: parse dependency ASTs in full mode #38278

Open
stamblerre opened this issue Apr 6, 2020 · 1 comment
Open

x/tools/gopls: parse dependency ASTs in full mode #38278

stamblerre opened this issue Apr 6, 2020 · 1 comment

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 6, 2020

We really only use dependency ASTs for finding definitions and documentation, and we can avoid extra work and AST traversal by precomputing what we need. In most cases, dependencies are only type-checked once. I propose this alternative:

  • We type-check all packages in "full" mode (allowing us to use the type information for analyses).
  • Instead of having different parse modes for files, we have different modes for PackageHandles, one for workspace packages (PackageHandle) and one for dependencies (ExportedPackageHandle). PackageHandle remains the same as it is now, while ExportedPackageHandle does not contain references to the package's ParseGoHandles. Rather, it contains a pre-computed table of information that can be used for various features. My guess is that it will be a table of token.Pos -> documentation, but I'm sure I missed things.

/cc @heschik @ianthehat

@stamblerre
Copy link
Contributor Author

@stamblerre stamblerre commented Nov 11, 2020

A while back, @findleyr and I discussed a related topic which might allow us to get accurate analysis results for dependencies without the memory cost of keeping full ASTs in memory. Rob suggested that we could try pruning the ASTs after analysis runs, so the facts generated by analyses would be correct, but we would not pay the cost of keeping the full ASTs in memory.

@stamblerre stamblerre changed the title x/tools/gopls: stop caching ASTs for dependencies x/tools/gopls: parse dependency ASTs in full mode Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.