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/refactor, rename: add -d option to show diffs #13355

Closed
lukehoban opened this issue Nov 22, 2015 · 7 comments
Closed

x/tools/refactor, rename: add -d option to show diffs #13355

lukehoban opened this issue Nov 22, 2015 · 7 comments

Comments

@lukehoban
Copy link

For IDE integrations, having gorename modify files directly means that the editor's undo operation will not work as expected. It would be nice if gorename had a flag to dump the proposed modifications to stdout instead.

@mdempsky
Copy link
Member

Why not instead make the IDE's undo operation work as expected when a source file is externally modified?

@RLH
Copy link
Contributor

RLH commented Nov 22, 2015

I think the point is that gorename is used as part of the opaque
implementation of the IDE and not something external as far as the user is
concerned. As such undo seems like a completely reasonable thing for an IDE
to do.

On Sat, Nov 21, 2015 at 8:55 PM, Matthew Dempsky notifications@github.com
wrote:

Why not instead make the IDE's undo operation work as expected when a
source file is externally modified?


Reply to this email directly or view it on GitHub
#13355 (comment).

@lukehoban
Copy link
Author

@RLH That's right. Editors/IDEs undo stacks never include edits to files made outside of the editor as far as I'm aware. Any action invoked by the user inside the editor is expected to make its modifications to editor buffers via the editors own text buffer APIs so that those edits are tracked on the undo stack. Pretty sure all of that is standard across tools.

So to have undo support, we would need forename to provide the set of edits and the editor plugin to actually apply these using the editors APIs.

@kostya-sh
Copy link
Contributor

Output in unified diff (or similar) format will also allow IDEs to show preview of the changes before applying them.

@lukehoban
Copy link
Author

@kostya-sh Agreed - using the same rendering as gofmt -d to provide a diff would allow tools to use the same logic they are using for processing gofmt edits for gorename as well.

@rsc rsc changed the title x/tools/refactor/rename: provide option to dump the proposed edits to stdout instead of writing to disk x/tools/refactor, rename: add -d option to show diffs Dec 28, 2015
@rsc rsc added this to the Unreleased milestone Dec 28, 2015
@rsc
Copy link
Contributor

rsc commented Dec 28, 2015

/cc @alandonovan

@alandonovan
Copy link
Contributor

@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants