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: rename should also handle references in godoc links #64495

Closed
dolmen opened this issue Dec 1, 2023 · 4 comments
Closed

x/tools/gopls: rename should also handle references in godoc links #64495

dolmen opened this issue Dec 1, 2023 · 4 comments
Assignees
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@dolmen
Copy link
Contributor

dolmen commented Dec 1, 2023

Go version

go version go1.21.4 darwin/arm64

What operating system and processor architecture are you using (go env)?

gopls v0.14.2

What did you do?

Renaming the FuncA function should also change the godoc link in FuncB documentation.

func FuncA() {
}

// FuncB is same as [FuncB].
func FuncB() {
}

What did you expect to see?

godoc link replaced with the reference to the new name of FuncA.

What did you see instead?

FuncA is still referenced but the symbol doesn't exist anymore. The documentation is now inconsistent (dangling link).

@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 Dec 1, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 1, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.16.0 Dec 1, 2023
@findleyr
Copy link
Contributor

findleyr commented Dec 1, 2023

Agreed, gopls should do this, at least within a single package. CC @adonovan

This is a good medium-difficulty project for someone to work on, but we'll try to get to it in gopls@v0.16.0 if nobody else is interested.

@rogeryk
Copy link
Contributor

rogeryk commented Dec 1, 2023

@findleyr Hi, I want try this.

@findleyr
Copy link
Contributor

findleyr commented Dec 1, 2023

Great, please go ahead!
Source is in gopls/internal/lsp/source/rename.go (see docComment).
Tests are in gopls/internal/test/marker, described by in the package documentation: https://pkg.go.dev/golang.org/x/tools/gopls/internal/test/marker
(There are more rename tests in gopls/internal/test/integration, but for this work you will probably only need a marker test).

@gopherbot
Copy link

Change https://go.dev/cl/548415 mentions this issue: gopls/internal/lsp/source: rename: Update the doc link associated with the object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants