Skip to content

Commit 1d18124

Browse files
committed
Support RSpec.describe in syntax
1 parent 9333ad7 commit 1d18124

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Preferences/SymbolList-Behaviour.tmPreferences

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
55
<key>name</key>
@@ -11,7 +11,7 @@
1111
<key>showInSymbolList</key>
1212
<integer>1</integer>
1313
<key>symbolTransformation</key>
14-
<string>s/^\s*(describe)\s+(.+)\s+do\s*$/$2/</string>
14+
<string>s/^\s*((?:RSpec\.)?[fx]?(?:describe|context|feature))\b\s*(.*?)do/$2/</string>
1515
</dict>
1616
<key>uuid</key>
1717
<string>28F89786-04F4-43D7-82A6-34B046C2BC6B</string>

Syntaxes/RSpec.tmLanguage

+19-4
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@
9494
<key>behaviour</key>
9595
<dict>
9696
<key>begin</key>
97-
<string>^\s*([fx]?(?:describe|context|feature))\b(?=.*\bdo\s*$)</string>
97+
<string>^\s*(RSpec\.)?([fx]?(?:describe|context|feature))\b(?=.*\bdo\s*$)</string>
9898
<key>beginCaptures</key>
9999
<dict>
100100
<key>1</key>
101+
<dict>
102+
<key>name</key>
103+
<string>entity.name.type.rspec</string>
104+
</dict>
105+
<key>2</key>
101106
<dict>
102107
<key>name</key>
103108
<string>keyword.other.rspec.behaviour</string>
@@ -130,6 +135,11 @@
130135
<key>captures</key>
131136
<dict>
132137
<key>1</key>
138+
<dict>
139+
<key>name</key>
140+
<string>entity.name.type.rspec</string>
141+
</dict>
142+
<key>2</key>
133143
<dict>
134144
<key>name</key>
135145
<string>keyword.other.rspec.behaviour</string>
@@ -138,7 +148,7 @@
138148
<key>comment</key>
139149
<string>Behaviours with multiline descriptions are not matched by `behaviour`, so as a fallback we just highlight the bare keywords</string>
140150
<key>match</key>
141-
<string>^\s*([fx]?(?:describe|context|feature))\b</string>
151+
<string>^\s*(RSpec\.)?([fx]?(?:describe|context|feature))\b</string>
142152
<key>name</key>
143153
<string>meta.rspec.behaviour</string>
144154
</dict>
@@ -200,9 +210,14 @@
200210
<key>1</key>
201211
<dict>
202212
<key>name</key>
203-
<string>keyword.other.rspec.pending</string>
213+
<string>entity.name.type.rspec</string>
204214
</dict>
205215
<key>2</key>
216+
<dict>
217+
<key>name</key>
218+
<string>keyword.other.rspec.pending</string>
219+
</dict>
220+
<key>3</key>
206221
<dict>
207222
<key>name</key>
208223
<string>string.ruby</string>
@@ -211,7 +226,7 @@
211226
<key>comment</key>
212227
<string>This only works with simple single / double quoted strings. But matching too liberally causes bugs (see https://github.com/rspec/rspec-tmbundle/issues/45), so better err on the safe side.</string>
213228
<key>match</key>
214-
<string>^\s*([fx]?(?:it|specify|scenario|describe|context|feature))\s+("[^"]*"|'[^']*')(?&lt;!do)\s*$</string>
229+
<string>^\s*(?:RSpec\.)?([fx]?(?:it|specify|scenario|describe|context|feature))\s+("[^"]*"|'[^']*')(?&lt;!do)\s*$</string>
215230
<key>name</key>
216231
<string>meta.rspec.pending</string>
217232
</dict>

0 commit comments

Comments
 (0)