[rspec-devel] [ rspec-Patches-11254 ] RSpec syntax coloring and function pop-up integration in TextMate

noreply at rubyforge.org noreply at rubyforge.org
Sun Jun 24 09:06:22 EDT 2007


Patches item #11254, was opened at 2007-05-31 10:43
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11254&group_id=797

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Wincent Colaiuta (wincent)
>Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: RSpec syntax coloring and function pop-up integration in TextMate

Initial Comment:
This patch makes two additions to the RSpec TextMate bundle to provide a better user experience: syntax coloring of RSpec keywords (before, after, describe, it), and display of behaviours and examples in the function pop-up menu. This latter feature is very useful for navigation when working with files with large numbers of specs. Examples appear indented.

Now, this is my first ever TextMate customization so I am sure someone more experienced could improve on the implementation, but in its basic form it works. Shortcomings of the current implementation:

- recognition occurs at the whole-line level, so syntax colouring only kicks in once you have typed the entire line

- recognition simplisticly divides the behaviour and example descriptions into three parts, the "describe" (or "it"), the "do", and "everything else" between the two

- this in turn means that there is no special syntax colouring of the "everything else"

- it also means that examples such as:

    it "should be valid" do
    ...
    end

will appear in the function pop-up with the enclosing quotes:

    "should be valid"

- likewise, a behaviour like:

    describe User, "at creation time" do
    ...
    end

Will appear in the function pop-up as:

    User, "at creation time"

- and shared behaviours will appear as:

    "All controllers", :shared => true

Hopefully someone with more knowledge about TextMate customization than I can address these issues, but as it stands I think the basic implementation is useful enough that life is better with the aid of these imperfect changes.

Will also try to attach a screenshot with the patch to show what the pop-up looks like.


----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-06-24 09:06

Message:
This sounds great, but I'm having some problems.

1) The patch doesn't apply cleanly against trunk r2121 with "patch -p0 < textmate.diff":

patching file Preferences/Symbol
patching file Preferences/Symbol
patching file info.plist
Hunk #1 FAILED at 280.
1 out of 1 hunk FAILED -- saving rejects to file info.plist.rej
patching file Syntaxes/RSpec.tmLanguage

$ cat info.plist.rej

***************
*** 280,285 ****
                 <string>240FDD9D-CD49-4917-9003-80A3E1DADFBA</string>
                 <string>B5906021-8E54-4863-A13B-EA46333DB5F1</string>
                 <string>67E726E0-63E2-4840-B8BB-37F665CD34B8</string>
         </array>
         <key>uuid</key>
         <string>4CEA47CC-2C3A-45FB-80BE-3820828227C2</string>
--- 280,288 ----
                 <string>240FDD9D-CD49-4917-9003-80A3E1DADFBA</string>
                 <string>B5906021-8E54-4863-A13B-EA46333DB5F1</string>
                 <string>67E726E0-63E2-4840-B8BB-37F665CD34B8</string>
+                <string>923F0A10-96B9-4792-99A4-94FEF66E0B8C</string>
+                <string>57EF6130-05A6-4117-94CB-C0BD63328334</string>
+                <string>28F89786-04F4-43D7-82A6-34B046C2BC6B</string>
         </array>
         <key>uuid</key>
         <string>4CEA47CC-2C3A-45FB-80BE-3820828227C2</string>

2) I tried to add the three rejected lines manually, and in the bundle editor I can see the new RSpec syntax, but I don't see the new preferences. Shouldn't they show up too?

3) There is no new syntax highlighting on my Textmate. How does TextMate know to use this highlighting? Do I need to do anything special to make it work?

4) How do I bring up the list over behaviours and examples shown in your screenshot? It must be some keyboard shortcut I'm unaware of.

Cheers,
Aslak

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11254&group_id=797


More information about the rspec-devel mailing list