[rspec-users] Does Ctrl-Shift-V in Textmate ever annoy you as an RSpec user?

David Chelimsky dchelimsky at gmail.com
Fri Apr 11 14:39:16 EDT 2008


On Apr 11, 2008, at 2:29 PM, Rick DeNatale wrote:

> I love the TextMate feature of syntax checking ruby source with ^V.
> But often when I use it in an RSpec example group or a story steps
> file, I run into the problem that, although the file is syntactically
> correct, I get all kinds of warnings like:
>
>
>   line 44: warning: useless use of '==' in void context
>
>
> which can produce a rather large tooltip, forcing me to scan to the
> end to see the Syntax OK I'm looking for, and worse, causing TextMate
> to scroll to the first line with a warning.
>
>
> Here's how to fix this:
>
>
> 1) Open the bundle editor, look at the Validate Syntax command in the
> Ruby bundle.  You want to create a similar command in the RSpec
> bundle.  Copy the text of this command, go to the RSpec bundle, add a
> new command, and paste the text in.  Make sure that the options save:
> nothing, input:entire document, output: show as tooltip, and
> activation: key equivalent are selected.  Click in the input field
> next to key equivalent and type ^-shift-v.  Set the scope to
> rspec.ruby.source
>
>
> 2)  Now look at the text for the command, change the line
>
>     result = `"${TM_RUBY:=ruby}" -wc 2>&1`
>
>      to
>
>     result = `"${TM_RUBY:=ruby}" -c -W1 2>&1`
>
>
> which kicks the warning level down a notch.
>
>
> 3) Now look at the language definition in the RSpec bundle
>
>   The first two lines should look like this:
>
> {    scopeName = 'source.ruby.rspec';
>    fileTypes = ( 'spec.rb' );
>
>
> change that second line to:
>
>
>    fileTypes = ( 'spec.rb', 'steps.rb' );
>
>
> This should let the bundle 'claim' story files as well.  You'll get a
> few snippets that aren't really appropriate, but having those
> expectation snippets in a steps file is nice.

Wanna make a patch?



More information about the rspec-users mailing list