[TxMt] Re: Fixing YAML Inline Hash Syntax Highlighting

Jacob Coby jcoby at portallabs.com
Fri Dec 12 19:18:30 UTC 2008


On Dec 11, 2008, at 2:59 AM, Michael Sheets wrote:

> On Dec 10, 2008, at 8:10 AM, Jacob Coby wrote:
>
>> Thanks.
>>
>> I've updated it since the last email because it wasn't  highlighting
>> lists correctly.
>
> Just committed this, thanks again.

One more, this time to separate hash keys from unquoted strings.  It  
basically treats everything as an unquoted string unless it matches  
some other rule.  I don't know if I used the correct scope or name,  
but it seems to work better otherwise.  There is still a need to add  
the document separator "---" and control codes "!"

Index: Syntaxes/YAML.plist
===================================================================
--- Syntaxes/YAML.plist	(revision 11005)
+++ Syntaxes/YAML.plist	(working copy)
@@ -91,34 +91,33 @@
  		<dict>
  			<key>captures</key>
  			<dict>
-				<key>1</key>
-				<dict>
-					<key>name</key>
-					<string>punctuation.definition.entry.yaml</string>
-				</dict>
  				<key>2</key>
  				<dict>
  					<key>name</key>
-					<string>entity.name.tag.yaml</string>
+					<string>keyword.hashkey.yaml</string>
  				</dict>
  				<key>3</key>
  				<dict>
  					<key>name</key>
-					<string>punctuation.separator.key-value.yaml</string>
+					<string>source.yaml</string>
  				</dict>
-				<key>4</key>
+			</dict>
+			<key>match</key>
+			<string>\s*(-?)\s*([\w\-_]+)\s*(:)\s*</string>
+			<key>name</key>
+			<string>keyword.yaml</string>
+		</dict>
+		<dict>
+			<key>captures</key>
+			<dict>
+				<key>1</key>
  				<dict>
  					<key>name</key>
-					<string>punctuation.definition.entry.yaml</string>
-				</dict>
-				<key>5</key>
-				<dict>
-					<key>name</key>
  					<string>string.unquoted.yaml</string>
  				</dict>
  			</dict>
  			<key>match</key>
-			<string>(?:(?:(-\s*)?(\w+\s*(:)))|(-))\s*([^,{}&#\[\]]+)\s*</ 
string>
+			<string>([^,{}&#\[\]"]+)</string>
  			<key>name</key>
  			<string>string.unquoted.yaml</string>
  		</dict>


--
Jacob Coby









More information about the textmate mailing list