Skip to content

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

@stamblerre

Description

@stamblerre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/performanceIssues related to gopls performance (CPU, memory, etc).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions