Thread overview | |||||
---|---|---|---|---|---|
|
January 26, 2016 Which tools do you use to refactor your codebase? | ||||
---|---|---|---|---|
| ||||
struct Foo{ void bar(){ } } auto f = Foo(); f.bar(); For example you decide that 'bar' was a very poor choice for a name but you have already used it in many different files and manually changing ever occurrence is very annoying. You also can't really make a global substitution (for example with vim regex) because other types may also have a method called 'bar'. Is there anything for D to help refactor names for types, functions, variables etc? |
February 01, 2016 Re: Which tools do you use to refactor your codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to maik klein | Am Tue, 26 Jan 2016 22:42:49 +0000 schrieb maik klein <maikklein@googlemail.com>: > struct Foo{ > void bar(){ > } > } > > auto f = Foo(); > f.bar(); > > For example you decide that 'bar' was a very poor choice for a name but you have already used it in many different files and manually changing ever occurrence is very annoying. > > You also can't really make a global substitution (for example with vim regex) because other types may also have a method called 'bar'. > > Is there anything for D to help refactor names for types, functions, variables etc? In Mono-D I press F2 and type the new name. -- Marco |
April 26, 2016 Re: Which tools do you use to refactor your codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to maik klein | On Tuesday, 26 January 2016 at 22:42:49 UTC, maik klein wrote: > struct Foo{ > void bar(){ > } > } > > auto f = Foo(); > f.bar(); > > For example you decide that 'bar' was a very poor choice for a name but you have already used it in many different files and manually changing ever occurrence is very annoying. > > You also can't really make a global substitution (for example with vim regex) because other types may also have a method called 'bar'. > > Is there anything for D to help refactor names for types, functions, variables etc? It's maybe premature to talk about this but DCD will probably support a new function that allows refactoring. I'm a bit forward with this feature and it's already in Coedit master: see it in action : https://vimeo.com/164209261 First you can see that the semantic is used because "variable" renaming is done only one the global. Later the same append with a Foo "foo" renamed to "instance" inside a function itself named "foo" and whose name is not affected. :) |
Copyright © 1999-2021 by the D Language Foundation