Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dart syntax highlighting for Sublime Text ported from VS Code's Dart plugin (https://github.com/Dart-Code/Dart-Code/blob/master/syntaxes/dart.json). Place in "Sublime Text 3\Packages\User"
<plist version="1.0">
<dict>
<key>name</key>
<string>Dart</string>
<key>fileTypes</key>
<array>
<string>dart</string>
</array>
<key>scopeName</key>
<string>source.dart</string>
<key>foldingStartMarker</key>
<string>\{\s*$</string>
<key>foldingStopMarker</key>
<string>^\s*\}</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>meta.preprocessor.script.dart</string>
<key>match</key>
<string>^(#!.*)$</string>
</dict>
<dict>
<key>begin</key>
<string>^\w*\b(library|import|part of|part|export)\b</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>keyword.other.import.dart</string>
</dict>
</dict>
<key>end</key>
<string>;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.terminator.dart</string>
</dict>
</dict>
<key>name</key>
<string>meta.declaration.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#strings</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>name</key>
<string>keyword.other.import.dart</string>
<key>match</key>
<string>\b(as|show|hide)\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.dart</string>
<key>match</key>
<string>\b(if)\b</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>include</key>
<string>#punctuation</string>
</dict>
<dict>
<key>include</key>
<string>#annotations</string>
</dict>
<dict>
<key>include</key>
<string>#keywords</string>
</dict>
<dict>
<key>include</key>
<string>#constants-and-special-vars</string>
</dict>
<dict>
<key>include</key>
<string>#strings</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>dartdoc</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(\[.*?\])</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>variable.name.source.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>^ {4,}(?![ \*]).*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>variable.name.source.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>```.*?$</string>
<key>contentName</key>
<string>variable.other.source.dart</string>
<key>end</key>
<string>```</string>
</dict>
<dict>
<key>match</key>
<string>(`.*?`)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>variable.other.source.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>(`.*?`)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>variable.other.source.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>(\* (( ).*))$</string>
<key>captures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.source.dart</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>comments</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.block.empty.dart</string>
<key>match</key>
<string>/\*\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>include</key>
<string>#comments-doc-oldschool</string>
</dict>
<dict>
<key>include</key>
<string>#comments-doc</string>
</dict>
<dict>
<key>include</key>
<string>#comments-inline</string>
</dict>
</array>
</dict>
<key>comments-doc-oldschool</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>/\*\*</string>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.documentation.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comments-doc-oldschool</string>
</dict>
<dict>
<key>include</key>
<string>#comments-block</string>
</dict>
<dict>
<key>include</key>
<string>#dartdoc</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>comments-doc</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>///</string>
<key>while</key>
<string>^\s*///</string>
<key>end</key>
<string>^\s*///</string>
<key>name</key>
<string>comment.block.documentation.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#dartdoc</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>comments-inline</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comments-block</string>
</dict>
<dict>
<key>match</key>
<string>((//).*)$</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>comment.line.double-slash.dart</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>comments-block</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>/\*</string>
<key>end</key>
<string>\*/</string>
<key>name</key>
<string>comment.block.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comments-block</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>annotations</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>storage.type.annotation.dart</string>
<key>match</key>
<string>@[a-zA-Z]+</string>
</dict>
</array>
</dict>
<key>constants-and-special-vars</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>constant.language.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(true|false|null)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>variable.language.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(this|super)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>constant.numeric.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>support.class.dart</string>
<key>match</key>
<string>(?&lt;![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\b|num\b|int\b|double\b|dynamic\b)</string>
</dict>
<dict>
<key>match</key>
<string>([_$]*[a-z][a-zA-Z0-9_$]*)(&lt;|\(|\s+=&gt;)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.function.dart</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>keywords</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>keyword.cast.dart</string>
<key>match</key>
<string>(?&lt;!\$)\bas\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.catch-exception.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(try|on|catch|finally|throw|rethrow)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(sync(\*)?|async(\*)?|await|yield(\*)?)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.dart</string>
<key>match</key>
<string>(?&lt;!\$)\bassert\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.new.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(new)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.declaration.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(abstract|class|enum|extends|extension|external|factory|implements|get|mixin|native|operator|set|typedef|with|covariant)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(is\!?)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.ternary.dart</string>
<key>match</key>
<string>\?|:</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.bitwise.dart</string>
<key>match</key>
<string>(&lt;&lt;|&gt;&gt;&gt;?|~|\^|\||&amp;)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.assignment.bitwise.dart</string>
<key>match</key>
<string>((&amp;|\^|\||&lt;&lt;|&gt;&gt;&gt;?)=)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.closure.dart</string>
<key>match</key>
<string>(=&gt;)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.comparison.dart</string>
<key>match</key>
<string>(==|!=|&lt;=?|&gt;=?)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.assignment.arithmetic.dart</string>
<key>match</key>
<string>(([+*/%-]|\~)=)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.assignment.dart</string>
<key>match</key>
<string>(=)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.increment-decrement.dart</string>
<key>match</key>
<string>(\-\-|\+\+)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.arithmetic.dart</string>
<key>match</key>
<string>(\-|\+|\*|\/|\~\/|%)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.logical.dart</string>
<key>match</key>
<string>(!|&amp;&amp;|\|\|)</string>
</dict>
<dict>
<key>name</key>
<string>storage.modifier.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(static|final|const|required|late)\b(?!\$)</string>
</dict>
<dict>
<key>name</key>
<string>storage.type.primitive.dart</string>
<key>match</key>
<string>(?&lt;!\$)\b(?:void|var)\b(?!\$)</string>
</dict>
</array>
</dict>
<key>string-interp</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\$([a-zA-Z0-9_]+)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>variable.parameter.dart</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>\$\{</string>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>string.interpolated.expression.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#constants-and-special-vars</string>
<key>name</key>
<string>variable.parameter.dart</string>
</dict>
<dict>
<key>include</key>
<string>#strings</string>
</dict>
<dict>
<key>name</key>
<string>variable.parameter.dart</string>
<key>match</key>
<string>[a-zA-Z0-9_]+</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>constant.character.escape.dart</string>
<key>match</key>
<string>\\.</string>
</dict>
</array>
</dict>
<key>strings</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?&lt;!r)"""</string>
<key>end</key>
<string>"""(?!")</string>
<key>name</key>
<string>string.interpolated.triple.double.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-interp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;!r)'''</string>
<key>end</key>
<string>'''(?!')</string>
<key>name</key>
<string>string.interpolated.triple.single.dart</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-interp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>r"""</string>
<key>end</key>
<string>"""(?!")</string>
<key>name</key>
<string>string.quoted.triple.double.dart</string>
</dict>
<dict>
<key>begin</key>
<string>r'''</string>
<key>end</key>
<string>'''(?!')</string>
<key>name</key>
<string>string.quoted.triple.single.dart</string>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;!\|r)"</string>
<key>end</key>
<string>"</string>
<key>name</key>
<string>string.interpolated.double.dart</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>invalid.string.newline</string>
<key>match</key>
<string>\n</string>
</dict>
<dict>
<key>include</key>
<string>#string-interp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>r"</string>
<key>end</key>
<string>"</string>
<key>name</key>
<string>string.quoted.double.dart</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>invalid.string.newline</string>
<key>match</key>
<string>\n</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;!\|r)'</string>
<key>end</key>
<string>'</string>
<key>name</key>
<string>string.interpolated.single.dart</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>invalid.string.newline</string>
<key>match</key>
<string>\n</string>
</dict>
<dict>
<key>include</key>
<string>#string-interp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>r'</string>
<key>end</key>
<string>'</string>
<key>name</key>
<string>string.quoted.single.dart</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>invalid.string.newline</string>
<key>match</key>
<string>\n</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>punctuation</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>punctuation.comma.dart</string>
<key>match</key>
<string>,</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.terminator.dart</string>
<key>match</key>
<string>;</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.dot.dart</string>
<key>match</key>
<string>\.</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment