Skip to content

Instantly share code, notes, and snippets.

@isao
Forked from davethesoftwaredev/TypeScript.plist
Last active November 30, 2023 11:59
Show Gist options
  • Save isao/5f6fbe89a438086c36d8 to your computer and use it in GitHub Desktop.
Save isao/5f6fbe89a438086c36d8 to your computer and use it in GitHub Desktop.
BBEdit Codeless Language Module for TypeScript syntax coloring and class/interface/function folding.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- https://gist.github.com/isao/5f6fbe89a438086c36d8
BBEdit Language Module for TypeScript
Put this file in
~/Library/Application Support/BBEdit/Language Modules
or equivalent.
Forked from
- https://gist.github.com/davethesoftwaredev/4056693
- https://gist.github.com/vtbassmatt/7242970
Which in turn were based on the language file for CoffeeScript found at
http://joyofmodeling.org/index.php/OSX/coffeescript-syntax-coloring-in-text-wrangler.html
See also http://www.barebones.com/support/develop/
-->
<plist version="1.0">
<dict>
<key>BBEditDocumentType</key>
<string>CodelessLanguageModule</string>
<key>BBLMLanguageDisplayName</key>
<string>TypeScript</string>
<key>BBLMLanguageCode</key>
<string>TypS</string>
<key>BBLMColorsSyntax</key>
<true/>
<key>BBLMScansFunctions</key>
<true/>
<key>BBLMIsCaseSensitive</key>
<true/>
<key>BBLMKeywordList</key>
<array>
<string>abstract</string>
<string>any</string>
<string>arguments</string>
<string>Array</string>
<string>as</string>
<string>async</string>
<string>await</string>
<string>bool</string>
<string>boolean</string>
<string>Boolean</string>
<string>break</string>
<string>case</string>
<string>catch</string>
<string>class</string>
<string>const</string>
<string>constructor</string>
<string>continue</string>
<string>Date</string>
<string>debugger</string>
<string>declare</string>
<string>default</string>
<string>delete</string>
<string>do</string>
<string>else</string>
<string>enum</string>
<string>Error</string>
<string>export</string>
<string>extends</string>
<string>false</string>
<string>finally</string>
<string>for</string>
<string>from</string>
<string>function</string>
<string>Function</string>
<string>get</string>
<string>if</string>
<string>implements</string>
<string>import</string>
<string>in</string>
<string>Infinity</string>
<string>instanceof</string>
<string>interface</string>
<string>isNaN</string>
<string>keyof</string>
<string>let</string>
<string>Math</string>
<string>module</string>
<string>namespace</string>
<string>NaN</string>
<string>new</string>
<string>null</string>
<string>number</string>
<string>Number</string>
<string>Object</string>
<string>of</string>
<string>private</string>
<string>Promise</string>
<string>protected</string>
<string>public</string>
<string>RegExp</string>
<string>readonly</string>
<string>return</string>
<string>self</string>
<string>set</string>
<string>static</string>
<string>string</string>
<string>String</string>
<string>super</string>
<string>switch</string>
<string>then</string>
<string>this</string>
<string>throw</string>
<string>true</string>
<string>try</string>
<string>type</string>
<string>typeof</string>
<string>undefined</string>
<string>unknown</string>
<string>var</string>
<string>void</string>
<string>while</string>
<string>with</string>
<string>yield</string>
</array>
<key>BBLMSuffixMap</key>
<array>
<dict>
<key>BBLMLanguageSuffix</key>
<string>.ts</string>
</dict>
<dict>
<key>BBLMLanguageSuffix</key>
<string>.tsx</string>
</dict>
</array>
<key>BBLMBalanceSpecialRunKinds</key>
<array>
<string>com.barebones.bblm.JavaScript.regexp</string>
<string>com.barebones.bblm.syntax-error</string>
</array>
<key>Language Features</key>
<dict>
<key>Identifier and Keyword Character Class</key>
<string>0-9A-Z_a-z$</string>
<key>Comment Pattern</key>
<string><![CDATA[(?x:
(?> (?<!\\) // .* $ ) |
(?> /\* (?s:.*?) (?> \*/ | \z ) )
)]]></string>
<key>Function Pattern</key>
<string><![CDATA[(?x:
(?P<leadspace>^[ \t]*)
(?P<function>
(?>export\s+)?
(?>abstract\s+)?
(?>class|interface|function)\s+
(?P<function_name>
([A-Za-z_$][\w$.]*)
)
(?s:.+?)
\r(?P=leadspace)\}
)
)]]></string>
<key>String Pattern</key>
<string><![CDATA[(?x:
(?> " [^"\r]* ") |
(?> ' [^'\r]* ') |
(?> ` [^`]* `)
)]]></string>
<key>Skip Pattern</key>
<string><![CDATA[
(?x:
(?P>comment) |
(?P>string)
)]]></string>
</dict>
</dict>
</plist>
@isao
Copy link
Author

isao commented Nov 8, 2017

@jtlapp: interesting, I wonder if that's because of the alternation in the comment regex: (?> /\* (?s:.*?) (?: \*/ | \z ) )

If you don't mind not matching the "or end of file" condition, you can remove the | \z part.

update: didn't seem to help.

@isao
Copy link
Author

isao commented Feb 6, 2018

I replaced some (?: with (?>, and tweaked the function pattern. Perf issue seems to have gone away, perhaps because of v12.1 update to 64 bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment