On Sep 7, 2006, at 2:11 PM, Molitor, Stephen L wrote: > What do you do for 'rename method' in TextMate? I'm aware of the > search > and replace in file feature but I was wondering if there was something > better. First, let me admit this is the point I have the least ideal solution for and I am interested in a Ruby Refactoring library I can wrap in TextMate commands. Remember though, knowing everything about a Ruby script is all but impossible until runtime. Given that, such a library would likely function off of heuristics, and that's about as accurate as... I use TextMate's Find in Project with a hand rolled regular expression. For your example of a method call I might try something like: Find: (\.|^[ \t]*)method_name\b Replace: $1new_name I can sometimes refine that a little depending on my knowledge of the project at hand. I always do a Find first, reality-check the matches, then Replace All. I find this works a very high percentage of the time, though I do make mistakes, of course. Here are my solutions to the other points: > There should be a background parser running all the time so > that you always know if you have syntax errors and can jump to them > with one click; it is so totally a waste of time for me to save, > then try to run, a file that the computer is in a position to know > wonÃÕ work. I built a TextMate command scoped to Ruby source with a key equivalent of apple-S that takes the document as input and asks TM to save the current document when triggered. (This essentially overrides Save in Ruby files, performs the Save, and allows me to hook in additional functionality. I feed the document to `ruby -c`. If it checks out, I display a Syntax OK tool tip (default output for this command). If errors are found, I use the exit_codes.rb support library that ships with TextMate to switch the output to HTML and display hyperlinked-back-to- the-source error messages. This command is an example in my upcoming book: http://www.pragmaticprogrammer.com/titles/textmate/index.html > I shouldnÃÕ have to type the names of well-known methods, > like File.new or (anything).each, or type in closing parentheses or > the keyword end, or fill in more than a couple of characters of > begin/rescue/ensure structures; it is never correct for a human to > hit keys when a computer, in principle, could provide the input. One word: snippets. TextMate ships with all the snippets I have written for Ruby and then some. > I should never have to scroll much; IDEs go to a lot of > trouble to make it trivial to jump from wherever to the source for > the method being called, or its docs, or the next compile error or > breakpoint, or variable declaration, or whatever. Scrolling back > and forth in a source-code file is just stupid. Apple-T to zoom to the needed file, shift-apple-T to zoom to the needed method. Once you get use to how it matches names you can go anywhere in an instant: 1. apple-T 2. bit-return (takes me to test/functional/beta_invite_test.rb) 3. shift-apple-T 4. teir-return (takes me to test_email_is_required) > Unit testing should be part of the infrastructure. To create > a test, or run a test, or look at test results, you shouldnÃÕ have > to hit more than one keystroke. Apple-R to run a test file, or shift-apple-R to run just the current test. Use zentest to auto-generate the tests (you can wrap that in a TextMate command with about three lines of Ruby, if you like). Hope this helps. James Edward Gray II