-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgegoplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Description
I had ~60 go files open in gopls. None of them had any unsaved changes (i.e. bytes on disk matched bytes in gopls memory). I noticed when opening a new file in my editor gopls was taking a long time. I tracked it down to the overlay logic in go/packages.
Here is roughly what happened.
- I opened file
foo.go
in a previously unopened package. - gopls does a go/packages
file=foo.go
query and passes an overlay that includes all 60 files. - In
processGolistOverlay()
it appends a new package to response.Packages for each overlay file's package - It marks all imports of response.Packages in needPkgsSet
addNeededOverlayPackages()
performs a "go list" call for all items in needPkgs, which takes 3 seconds in my case.
I don't fully understand the package overlay stuff, but here are my observations:
- it doesn't seem like we need to treat "saved" files as overlays
- even if they are "real" overlays, go/packages seems to be doing too much work when querying only for foo.go (i.e. most overlay packages are not related to foo.go's package, so why do we list them and all their dependencies?)
- the overlay work is redone every time gopls invokes go/packages to look up a new file even if none of the overlays have changed
/cc @matloob @stamblerre
jirfag
Metadata
Metadata
Assignees
Labels
FrozenDueToAgegoplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.