Skip to content

x/tools: better isolate lsp code under gopls submodule #54509

Closed
@rsc

Description

@rsc

Today there is a module reference cycle between x/tools and x/text,
which we'd ideally like to remove to make it easier to tag modules.

x/text depends on x/tools for x/tools/go/loader.
That should probably be updated to use go/packages, but so be it.
It's a fairly reasonable use of x/tools either way.

x/tools depends on x/text only for x/tools/internal/lsp/source,
which uses golang.org/x/text/unicode/runenames in Hover.

The reference cycle would “naturally” go away if we move some of the internals around
so that internal/lsp can move to gopls/internal/lsp.
There are very few uses of internal/lsp outside gopls, and what's there is fairly generic
and would make sense outside of internal/lsp.

So it looks like this would work:

internal/lsp/diff -> internal/diff (used in go/analysis/analysistest)
internal/lsp/fuzzy -> internal/fuzzy (used in internal/analysisinternal)
internal/lsp/debug/tag -> internal/event/tag (used in internal/jsonrpc2)
internal/lsp -> gopls/internal/lsp

At that point the x/text reference would be entirely under gopls.

That feels cleaner anyway, and also a step toward making it possible to move gopls to x/gopls at some point.

It's a pretty straightforward change, especially since package boundaries and package names are not changing.
I'm happy to send the CLs.

Is there any gotcha here that I'm missing?

/cc @hyangah @adonovan @findleyr @ianthehat @heschi

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.ToolsThis label describes issues relating to any tools in the x/tools repository.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions