go icon indicating copy to clipboard operation
go copied to clipboard

x/tools/gopls: update package and imports on willRenameFiles/didRenameFiles

Open webngt opened this issue 2 years ago • 5 comments

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.

webngt avatar Jun 07 '23 14:06 webngt

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.

findleyr avatar Jun 15 '23 15:06 findleyr

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

hyangah avatar Jun 16 '23 02:06 hyangah

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

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

findleyr avatar Jun 20 '23 19:06 findleyr

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

findleyr avatar Jun 20 '23 19:06 findleyr

@suzmue Hi, I'm sorry @you. Is there any plan to release this function in the near future.

chaozwn avatar Jun 28 '24 13:06 chaozwn