Closed Sh4rK closed 5 years ago
marked as FR. I doubt I'd even look into cross-package refactory as it's not something I'm a fan of but locals and globals should be safe
You could now integrate gorename. It's designed for both manual cli use as well as direct text-editor integration:
Examples:
% gorename -offset file.go:#123 -to foo
Rename the object whose identifier is at byte offset 123 within file file.go.
@DisposaBoy - +1 for adding support for gorename.
I have been looking for a way to use gorename in an easy way all day, that would be AWESOME!
Has anyone looked into this one yet? I thought it might be as simple as just chucking in a command that takes the current cursor pos, and an input string from the user, and shells out to gorename. But then I wondered if it needed to handle dirty views, or to just work only if the current view isn't dirty?
@justinfx - I've taken a stab at it, but I'm not sure how to get sublime to see my $PATH--I'd rather not have to hardcode a path to gorename
.
https://github.com/smartystreets/sublime-gorename/blob/master/gorename.py
Am I missing something simple?
That is something that should already be handled by GoSublime
https://github.com/DisposaBoy/GoSublime/blob/master/gosubl/gs.py
The env is a settings value that allows you to point it at the desired bin locations. For instance, I have mine include my GOBIN. So you should be able to run subprocess and pass it the env. What you are doing is more or less what I thought to do as a bare minimum, but I wondered if anyone thought it should take into consideration dirty views.
Also you may want to switch your subprocess call to use the list form, and not use shell=True. It is easier to avoid quoting and escaping issues, especially if the file path has spaces.
On Sun, 16 Nov 2014 12:58 PM Michael Whatcott notifications@github.com wrote:
@justinfx https://github.com/justinfx - I've taken a stab at it, but I'm not sure how to get sublime to see my $PATH--I'd rather not have to hardcode a path to gorename.
https://github.com/smartystreets/sublime-gorename/blob/master/gorename.py
Am I missing something simple?
— Reply to this email directly or view it on GitHub https://github.com/DisposaBoy/GoSublime/issues/114#issuecomment-63198226 .
Ok, thanks for the pointers @justinfx. Not sure if I'll be getting to this anytime soon. If my code helps someone else move this forward that's great too.
Maybe I will take what you started and propose a merge request to GoSublime
On Sun, 16 Nov 2014 7:16 PM Michael Whatcott notifications@github.com wrote:
Ok, thanks for the pointers @justinfx https://github.com/justinfx. Not sure if I'll be getting to this anytime soon. If my code helps someone else move this forward that's great goo.
— Reply to this email directly or view it on GitHub https://github.com/DisposaBoy/GoSublime/issues/114#issuecomment-63206577 .
Go for it!
+1 @justinfx
Comments welcome, on merge request #569
would love to see this merged. it's been 7 months since the pull request I had made.
me too...
@DisposaBoy - Thanks for creating a great plugin for go development. I've written so much code with this tool!
Being able to safely rename a variable across an entire project from within the editor is a powerful capability. This PR would be a great addition to GoSublime. Once you've had the ability to rename any token at will in other languages, programming in go feels clunky. The good news: The go plugin for Intellij already supports this behavior and it's awesome. Just sayin'.
Pretty sure the project is abandoned. What with this pull request being a year old.
A great golang plugin has dead :(
It would be nice to have a feature to rename symbols (variables, structure fields, functions etc) in a syntax-aware way, and across all files of a package (or even inter-package, but I'm not sure about that).