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: restrict references to workspace packages #59674

Closed
findleyr opened this issue Apr 17, 2023 · 3 comments
Closed

x/tools/gopls: restrict references to workspace packages #59674

findleyr opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
FrozenDueToAge gopls/incremental gopls Issues related to the Go language server, gopls. release-blocker Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

After the rewrite of references/rename, these operations became agnostic to the set of workspace packages. As such, finding references on e.g. fmt.Println will find references throughout the module graph, not just in workspace modules.

This is a change in behavior, may produce noisy references, and can lead to slow initial performance of queries, as we only pre-compute reference indexes for workspace packages.

We should filter these queries to workspace packages.

@findleyr findleyr added this to the gopls/v0.12.0 milestone Apr 17, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Apr 17, 2023
@adonovan
Copy link
Member

I don't think a rename operation should ever proceed with less than the complete scope of the identifier, as this would leave things in a bad state. If you really want to rename fmt.Println, it should touch every module in the module graph (and hopefully a good client will notice that you're attempting to modify readonly modules in the cache and abort before corrupting the cache or editing any other files). So I propose to leave out rename for now (as we discussed offline).

@gopherbot
Copy link

Change https://go.dev/cl/487016 mentions this issue: gopls/internal/lsp/cache: cleanups to active packages

@gopherbot
Copy link

Change https://go.dev/cl/487017 mentions this issue: gopls/internal/lsp/source: references: restrict search to workspace packages

gopherbot pushed a commit to golang/tools that referenced this issue Apr 21, 2023
This CL makes a number of preparatory cleanups before
I tackle golang/go#59674:

- (*snapshot).dumpWorkspace deleted (obsolete)
- cache.newMemoizedFS deleted (dead code)
- snapshot.workspaceMetadata deleted (use Snapshot.WorkspaceMetadata instead).
- Snapshot.ActiveMetadata renamed WorkspaceMetadata
  and obsolete comment updated
- (*snapshot).isWorkspacePackage deleted (dead code)
  [Interestingly this method didn't show up in the output of Rob's script.]
- Snapshot: begin to group methods in a meaningful way.
- Remove Get prefix from Snapshot.CriticalError
- terminological tweaks.

Updates golang/go#59674

Change-Id: I9c0fcd6073270f75dad0f2e91ac6b3864358a5f1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/487016
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
@golang golang locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls/incremental gopls Issues related to the Go language server, gopls. release-blocker Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants