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: update package and imports on willRenameFiles/didRenameFiles #60903

Open
webngt opened this issue Jun 7, 2023 · 4 comments
Open
Assignees
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@webngt
Copy link

webngt commented Jun 7, 2023

when I move go file between folders I want VSCode to automatically update package name and imports in go files that reference file being moved. Like it happens in Intellij Goland

Many thanks in advance for any feedback.

@findleyr
Copy link
Contributor

Thanks for the request. I agree this would be a useful feature, and I think it wouldn't be that hard to implement (provided we can capture the context correctly).

@hyangah is there an easy way for the VS Code Go extension to detect this type of move? We can add a gopls custom command to update the new file.

@hyangah
Copy link
Contributor

hyangah commented Jun 16, 2023

How about LSP's workspace/didRenameFiles or workspace/willRenameFIles?
It doesn't seem like gopls is utilizing this feature (available since LSP3.16) yet.

@findleyr
Copy link
Contributor

How about LSP's workspace/didRenameFiles or workspace/willRenameFIles

Oh, right, that's exactly what we need. Thanks!

@findleyr findleyr changed the title update package and imports on file move x/tools/gopls: update package and imports on willRenameFiles/didRenameFiles Jun 20, 2023
@findleyr
Copy link
Contributor

Transfering to the Go issue tracker. This is a nice medium-sized project.

@findleyr findleyr transferred this issue from golang/vscode-go Jun 20, 2023
@findleyr findleyr added this to the gopls/v0.13.0 milestone Jun 20, 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 Jun 20, 2023
@adonovan adonovan added the Refactoring Issues related to refactoring tools label Aug 31, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.0, gopls/v0.15.0 Oct 9, 2023
@findleyr findleyr modified the milestones: gopls/v0.15.0, gopls/v0.16.0 Dec 12, 2023
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. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants