Padre: Ticket Queryhttp://padre.perlide.org/trac/query?status=!closed&keywords=~refactor&order=type
Perl Application Development and Refactoring Environmenten-USPadre/static/logo.pnghttp://padre.perlide.org/trac/query?status=!closed&keywords=~refactor&order=type
Trac 1.0.1http://padre.perlide.org/trac/ticket/645
http://padre.perlide.org/trac/ticket/645#645: Lexically rename variable changes the screen position dramatically (and shouldn't have to)Sat, 03 Oct 2009 16:30:03 GMTadamk<p>
In the current implementation, the "Lexically Rename Variable" function results in a long wait to parse the document (which is not a big deal) followed by a dramatic snap to a new focus and line (which is really annoying).
</p>
<p>
The Lexically Rename Variable function inherently should never change the line quantity or the position of any code. As a result, we SHOULD be able to remember and keep the position of the editor at the time of the Lexical Rename Variable menu entry being fired and keep it at the end of the replacement.
</p>
Resultshttp://padre.perlide.org/trac/ticket/645#changeloghttp://padre.perlide.org/trac/ticket/816
http://padre.perlide.org/trac/ticket/816#816: Lexical variable renaming doesn't support <<"HEREDOCS"Wed, 06 Jan 2010 05:53:38 GMTadamk<p>
The lexical variable rename function currently reaches into "" quoted strings correctly and changes them.
</p>
<p>
However, it currently overlooks code in the "rollup" section of a heredoc operator. That content needs to be processed in the same way as the double quoted string.
</p>
Resultshttp://padre.perlide.org/trac/ticket/816#changeloghttp://padre.perlide.org/trac/ticket/937
http://padre.perlide.org/trac/ticket/937#937: Variable renaming: No declaration found if variable is declared in parenthesesSun, 02 May 2010 19:17:12 GMTzenogantner<p>
How to reproduce:
Load/create a Perl file such a variable declaration:
</p>
<p>
my ($var);
</p>
<p>
Try to rename the variable.
It does not work: "No declaration could be found for the specified (lexical?) variable.
</p>
<p>
What should happen: Should work as for a variable declared by
</p>
<p>
my $var;
</p>
Resultshttp://padre.perlide.org/trac/ticket/937#changeloghttp://padre.perlide.org/trac/ticket/1024
http://padre.perlide.org/trac/ticket/1024#1024: "Change variable style" does not always work properlyTue, 12 Oct 2010 08:57:43 GMTzenogantner<p>
The following things do not work as expected for me:
</p>
<p>
var: '$number_of_lines'
action: to Using_Underscores
expected: '$Number_Of_Lines'
got: '$Number_of_lines'
</p>
<p>
var: '$Number_Of_Lines'
action: to using_underscores
expected: '$number_of_lines'
got: '$number<span class="underline">of</span>lines'
</p>
<p>
var: '$Number_Of_Lines'
action: to Using_Underscores
expected: '$Number_Of_Lines'
got: '$Number<span class="underline">Of</span>Lines'
</p>
Resultshttp://padre.perlide.org/trac/ticket/1024#changeloghttp://padre.perlide.org/trac/ticket/1349
http://padre.perlide.org/trac/ticket/1349#1349: renaming variable names inside regular expressions does not workTue, 11 Oct 2011 14:43:53 GMTzenogantner<p>
How to reproduce:
</p>
<ul><li>load the file <tt>Padre/Document/Java/FunctionList.pm</tt> from the Padre source (it exists in <a class="changeset" href="http://padre.perlide.org/trac/changeset/16930" title="update German translation">r16930</a>)
</li><li>move cursor to the line where the variable $n is defined
</li><li>use Alt-Shift-R to rename (works)
</li><li>now do the same with the occurrence of this variable inside the regular expression below
</li><li>result: You get a prompt for renaming, but an error message afterwards
</li></ul>Resultshttp://padre.perlide.org/trac/ticket/1349#changeloghttp://padre.perlide.org/trac/ticket/279
http://padre.perlide.org/trac/ticket/279#279: Refactoring support: automatic global-to-lexical conversionTue, 24 Mar 2009 10:47:36 GMTtsee<p>
I recently had the non-fun experience of having to refactor a moderately large single-file program that was not strict-clean. No variable declarations anywhere.
</p>
<p>
In such programs, variables are still usually being used like lexicals. Very few variables are *really* global.
</p>
<p>
My experience was that getting the program strict clean and declaring all variables lexically in the tightest possible scope went a long way towards making the program more readable and accessible.
</p>
<p>
The way there, however, was paved with rather tedious hours of work. Therefore, I propose the ultimately useful refactoring feature:
</p>
<p>
In a similar fashion to the lexical-variable renaming, introduce a feature that finds the tightest scope in which a given variable could be declared lexically and then does so. Of course, this doesn't work for true globals, but honestly, I believe those can be identified rather easily in most cases.
</p>
<p>
This is not an easy task, however. The lexical rename walks the PPI tree upwards until it finds a scope in which (not including arbitrary sub-scopes, I hope) there is a declaration of the variable. This would have to do something remotely similar, but really the other way around. Starting from the top-level, recurse into all sub scopes and find out whether the variable is used there. If it's only used in one of them, go into that one and rinse, repeat. I'm sure there's something (apart from the trivial "this will be ugly to implement using PPI") I'm missing.
</p>
<p>
Of course, this feature won't work well for reused variable names such as $i for iteration. But it'd still be a start!
</p>
Resultshttp://padre.perlide.org/trac/ticket/279#changeloghttp://padre.perlide.org/trac/ticket/494
http://padre.perlide.org/trac/ticket/494#494: Rename variable options and preview windowWed, 19 Aug 2009 12:01:54 GMTszabgab<p>
In the Rename variable we could add a few options ideas from Visual Studio:
Check boxes:
</p>
<blockquote>
<p>
[ ] Preview reference changes
[ ] Search in comments
[ ] Search in strings
</p>
</blockquote>
<p>
Then it shows a "preview code changes" window where you can see the places it going to change the code. (I can also imagine a tool to show a diff between two changes, or the current version and the version after the change.
</p>
Resultshttp://padre.perlide.org/trac/ticket/494#changeloghttp://padre.perlide.org/trac/ticket/525
http://padre.perlide.org/trac/ticket/525#525: Feature request: "Rename subroutine"Wed, 09 Sep 2009 13:30:50 GMTrhebus<p>
Subroutine renaming is an important refactoring technique. Often you find that the name you originally used for a subroutine wasn't ideal, but by the time you have thought of a better, clearer name it is already referenced 20 times in 10 files.
</p>
<p>
A "rename subroutine" function would rename the subroutine *and* all references to it throughout the project. Clearly this requires syntactic parsing of all files in the project; a global search-and-replace is flaky and dangerous since it will change subroutines with the same name in different packages.
</p>
<p>
More info on subroutine renaming:
<a class="ext-link" href="http://en.wikipedia.org/wiki/Rename_method"><span class="icon">​</span>http://en.wikipedia.org/wiki/Rename_method</a>
<a class="ext-link" href="https://eclipse-tutorial.dev.java.net/visual-tutorials/refactoringrenamefieldandmethod.html"><span class="icon">​</span>https://eclipse-tutorial.dev.java.net/visual-tutorials/refactoringrenamefieldandmethod.html</a> -- example of rename field and method in eclipse for Java
</p>
Resultshttp://padre.perlide.org/trac/ticket/525#changeloghttp://padre.perlide.org/trac/ticket/535
http://padre.perlide.org/trac/ticket/535#535: Preview window for extract subroutineThu, 10 Sep 2009 07:57:16 GMTszabgab<p>
I am always afraid of using these magic tools for code refactoring. If I could see up-front what a certain action will do, that would improve my confidence by a lot.
</p>
<p>
So I'd like to see a way to preview the changes the extract subroutine will do.
</p>
<p>
I am not sure if I want to see the new code, a unix-like textual diff, a side-by-side diff of some external tool or something totally different but any one of these could be a huge step forward in gaining confidence.
</p>
Resultshttp://padre.perlide.org/trac/ticket/535#changeloghttp://padre.perlide.org/trac/ticket/829
http://padre.perlide.org/trac/ticket/829#829: Switch if-SyntaxSat, 23 Jan 2010 09:49:05 GMTSewi<p>
A really cool Perl document module addition would be a hotkey for switching between both if - syntaxes:
</p>
<pre class="wiki">print 1 if $foo == $bar;
</pre><p>
into
</p>
<pre class="wiki">if ($foo == $bar) {
print 1;
}
</pre><p>
and vice versa
</p>
Resultshttp://padre.perlide.org/trac/ticket/829#changeloghttp://padre.perlide.org/trac/ticket/901
http://padre.perlide.org/trac/ticket/901#901: (wishlist) variable renaming: highlighting, inline-editingThu, 18 Mar 2010 19:40:36 GMTzenogantner<p>
When renaming a variable, all occurrences of the variable should be highlighted, so that users see where there will be consequences.
</p>
<p>
One more step would be to allow inline editing: Instead of a pop-up window, the variable is renamed in-place, and the user can see all other occurrences change at the same time.
</p>
Resultshttp://padre.perlide.org/trac/ticket/901#changeloghttp://padre.perlide.org/trac/ticket/910
http://padre.perlide.org/trac/ticket/910#910: direct manipulation in outlineTue, 30 Mar 2010 09:11:25 GMTzenogantner<p>
It would be nice to be able to perform direct manipulation of the (Perl or other) document using the outline pane:
</p>
<p>
Add/remove pragamata
Add/remove used modules
<a class="missing wiki">Add/Remove?</a> methods/subs
<a class="missing wiki">Copy/Paste?</a> methods/subs
Rename methods/subs
</p>
Resultshttp://padre.perlide.org/trac/ticket/910#changeloghttp://padre.perlide.org/trac/ticket/955
http://padre.perlide.org/trac/ticket/955#955: Feature request: "Rename label"Tue, 25 May 2010 15:06:46 GMTzenogantner<p>
I would like to be able to rename labels with Padre.
</p>
<p>
e.g.
</p>
<p>
LABEL:
while (&lt;&gt;) {
</p>
<blockquote>
<p>
next LABEL if ...
</p>
</blockquote>
<p>
</p>
<blockquote>
<p>
...
</p>
</blockquote>
<p>
}
</p>
<p>
would be renamed to
</p>
<p>
LINE:
while (&lt;&gt;) {
</p>
<blockquote>
<p>
next LINE if ...
</p>
</blockquote>
<p>
</p>
<blockquote>
<p>
...
</p>
</blockquote>
<p>
}
</p>
<p>
in one step.
</p>
Resultshttp://padre.perlide.org/trac/ticket/955#changeloghttp://padre.perlide.org/trac/ticket/991
http://padre.perlide.org/trac/ticket/991#991: rename project-wide variable/function nameThu, 02 Sep 2010 09:17:53 GMTzenogantner<p>
Currently, renaming variables is only supported within one file.
It would be nice if one could also rename subroutines, in particular methods, and perform all those renaming actions project-wide
</p>
<p>
Things like Moose and XSAccessor should be supported as well.
</p>
Resultshttp://padre.perlide.org/trac/ticket/991#changeloghttp://padre.perlide.org/trac/ticket/996
http://padre.perlide.org/trac/ticket/996#996: refactoring: renaming of hash keysThu, 02 Sep 2010 11:34:42 GMTzenogantner<p>
Another nice refactoring feature would be the renaming of hash keys in the current scope.
</p>
<p>
E.g. you want to rename the key 'replace' to 'replace_button' in the following code:
</p>
<pre class="wiki">
# The "Replace" button
$self-&gt;{replace} = Wx::Button-&gt;new(
$self,
Wx::wxID_REPLACE,
Wx::gettext("&amp;Replace"),
);
Wx::Event::EVT_BUTTON(
$self,
$self-&gt;{replace},
sub {
$_[0]-&gt;replace_button;
}
);
Wx::Event::EVT_CHAR(
$self-&gt;{replace},
sub {
$self-&gt;hotkey( $_[1]-&gt;GetKeyCode );
}
);
$self-&gt;{replace}-&gt;SetDefault;
</pre><p>
Then having this rename-feature would come in handy, and it would be nicer to use than the normal 'search and replace' function.
</p>
<p>
The functionality could be integrated into one action 'rename' that renames several other things like variables, subroutines, or modules.
Having a menu entry and a context menu entry for the one action won't make the user interface more complicated, just more consistent.
</p>
Resultshttp://padre.perlide.org/trac/ticket/996#changeloghttp://padre.perlide.org/trac/ticket/998
http://padre.perlide.org/trac/ticket/998#998: refactoring: replace double quotes by single quotes where appropriateThu, 02 Sep 2010 12:17:38 GMTzenogantner<p>
Apply to selected text or complete document.
</p>
<p>
Some examples:
</p>
<pre class="wiki">"bla" --&gt; 'bla'
"$value" --&gt; "$value"
"'" --&gt; "'"
"You said \"that\"." --&gt; 'You said "that".'
qq{Some text} --&gt; q{Some text}
</pre>Resultshttp://padre.perlide.org/trac/ticket/998#changelog