|
1 | | -### [Introduction](https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/documentation/index.md) |
2 | | -### [Github](https://github.com/RedCMD/TmLanguage-Syntax-Highlighter) |
3 | | -### [Rules](https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/documentation/rules.md) |
4 | | -### [Schema](https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/vscode.tmLanguage.schema.json) |
| 1 | +## Introduction |
| 2 | + |
| 3 | +TextMate is a general purpose GUI text editor for MacOS released by [MacroMates](https://macromates.com/). |
| 4 | +It is also a language grammar specification that is mainly used for syntax highlighting. |
| 5 | +Supported by [VSCode](https://code.visualstudio.com/), [Github](https://github.com/github-linguist/linguist), [Sublime](https://www.sublimetext.com/), [Atom](https://github.com/atom) and of course [TextMate](https://macromates.com/manual/en/language_grammars). |
| 6 | + |
| 7 | +TextMate has a lot of incomplete and fragmented [documentation](https://macromates.com/manual/en/). |
| 8 | +Hopefully this can be a comprehensive guide for VSCode's JSON TextMate. |
| 9 | + |
| 10 | +VSCode supports TextMate in [JSON](https://www.json.org/json-en.html) (`.tmLanguage.json`) and [XML](https://en.wikipedia.org/wiki/XML) (`.tmLanguage`) formats. |
| 11 | +[TextMate](https://macromates.com/manual/en/appendix#property-list-format) uses the [old-style property list format](http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Articles/OldStylePListsConcept.html) (Which Apple has kindly removed the link for us). |
| 12 | +Sublime supports [YAML](https://yaml.org/). |
| 13 | +Atom supports [CSON](https://github.com/lifthrasiir/cson). |
| 14 | + |
| 15 | +TextMate is a top down line based lexer. This was done for performance reasons. |
| 16 | +Meaning you cant match new lines `\n`. |
| 17 | + |
| 18 | +The rest of this file will be in the context of VSCode's TextMate JSON. |
| 19 | + |
| 20 | +* Todo: Improve layout of this file. Split each section into its own separate file? |
| 21 | + |
| 22 | +## Package.json |
| 23 | +VSCode TextMate syntax files use the file extension `.tmLanguage.json` and are located in `./extensions/publisher.extension_name.version/syntaxes/*`. |
| 24 | +Todo: Explain basics of the `Package.json` in relation to TextMate syntaxes. |
| 25 | + |
| 26 | +## [Rules](rules.md) |
| 27 | + |
| 28 | +## Regex |
| 29 | +VSCode TextMate uses the [oniguruma](https://github.com/kkos/oniguruma) dialect. |
| 30 | +It used to use Ruby. |
| 31 | +Here is a list of all valid regex [expressions](https://github.com/kkos/oniguruma/blob/master/doc/RE). |
| 32 | +[regex.tmLanguage.json](https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/syntaxes/regex.tmLanguage.json). |
| 33 | +`\\K` [Keep](https://github.com/kkos/oniguruma/blob/master/doc/RE#L183) effectively moves the start position of the captured text. |
| 34 | +`\\G` [MatchAnchor](https://github.com/kkos/oniguruma/blob/master/doc/RE#L182) matches against the end of a [begin](./rules.md#begin) rule. |
| 35 | +Capture groups inside a positive-lookaround can be targeted by [capture](rules.md#capture). |
| 36 | +Capture groups inside a negative-lookaround will cause an error. Use non-capture group `(?:...)` instead. |
| 37 | + |
| 38 | +## Embedded Languages |
| 39 | +[embedded-languages](https://code.visualstudio.com/api/language-extensions/embedded-languages) |
| 40 | +Todo: |
| 41 | + |
| 42 | + |
| 43 | +## More Links |
| 44 | +- https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide |
| 45 | +- https://code.visualstudio.com/api/language-extensions/embedded-languages |
| 46 | +- https://macromates.com/manual/en/ |
| 47 | +- https://macromates.com/textmate/manual/ |
| 48 | +- https://www.apeth.com/nonblog/stories/textmatebundle.html |
| 49 | +- https://www.sublimetext.com/docs/3/scope_naming.html |
| 50 | +- https://www.regular-expressions.info/refquick.html\ |
| 51 | +- https://gist.github.com/Aerijo/b8c82d647db783187804e86fa0a604a1 |
| 52 | +- https://gist.github.com/DamnedScholar/622926bcd222eb1ddc483d12103fd315 |
| 53 | +- https://github.com/kkos/oniguruma/blob/master/doc/RE |
| 54 | +- https://github.com/chbk/flight-manual.atom.io/blob/scopes/content/hacking-atom/sections/syntax-naming-conventions.md |
| 55 | +- https://github.com/jeff-hykin/better-cpp-syntax/blob/master/documentation/library/textmate_while.md |
| 56 | +- https://github.com/RedCMD/TmLanguage-Syntax-Highlighter |
| 57 | +- https://github.com/bevry/cson#what-is-cson |
| 58 | +- https://github.com/microsoft/vscode/tree/main/extensions |
| 59 | +- https://github.com/microsoft/vscode/blob/main/extensions/json/syntaxes/JSON.tmLanguage.json |
| 60 | +- https://github.com/dunstontc/textmate/blob/master/readme.md |
| 61 | +- https://github.com/microsoft/vscode-textmate/issues/208 |
| 62 | +- https://github.com/microsoft/vscode-textmate/issues/193 |
| 63 | +- https://github.com/microsoft/vscode-textmate/issues/167 |
| 64 | +- https://github.com/microsoft/vscode-textmate/issues/140 |
| 65 | +- https://github.com/microsoft/vscode-textmate/issues/127 |
| 66 | +- https://github.com/microsoft/vscode-textmate/issues/83 |
| 67 | +- https://github.com/microsoft/vscode-textmate/issues/74 |
| 68 | +- https://github.com/microsoft/vscode-textmate/issues/52 |
| 69 | +- https://github.com/microsoft/vscode-textmate/issues/48 |
| 70 | +- https://github.com/Microsoft/vscode-textmate/issues/12 |
0 commit comments