You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gopls/internal/cache/parsego: add File.Cursor, and use it
This CL adds a Cursor to the parsego.File. Though the primary
motivation is convenience and flexibility, it is expected
to be an optimization: though it is computed eagerly,
it is retained in the parse cache, and is expected to pay
for itself very quickly by allowing us to replace many
whole-File ast.Inspect operations with more targeted traversals.
The CL replaces all ast.Inspect(file) operations with Cursor,
but there remain many more opportunities for using it in
narrower traversals, and in places that need to navigate to
siblings or ancestors.
Also, amend Cursor.FindPos to use the complete range of the
File, as CL 637738 recently did for astutil.NodeContains.
Also, various clean-ups to InlayHint:
- push the traversals down in InlayHint to avoid having
to scan a slice for every single node we visit;
- simplify the function signature used for each hint
algorithm.
Change-Id: I64d0c2cae75fd73a4b539ceb81ad9d6f7d80cfb8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/650396
Reviewed-by: Jonathan Amsterdam <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Commit-Queue: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
0 commit comments