TextMate is a general purpose GUI text editor for MacOS released by MacroMates.
It is also a language grammar specification that is mainly used for syntax highlighting.
Supported by VSCode, Github, Sublime, Atom and of course TextMate.
TextMate has a lot of incomplete and fragmented documentation.
Hopefully this can be a comprehensive guide for VSCode's JSON TextMate.
Supported formats:
- VSCode
- TextMate
- Ascii Plist
.tmLanguage(Old-style Property Lists format parser)
- Ascii Plist
- Sublime
- YAML
.yaml
- YAML
- Atom
- CSON
.cson
- CSON
- Github-Linguist
- JSON
.json - XML
.plist,.tmlanguage - YAML
.yaml-tmlanguage - CSON
.cson
- JSON
TextMate is a top down line based lexer. This was done for performance reasons.
Meaning you can't match past/over new lines \n.
VSCode's TextMate grammar files use the file extension .tmLanguage.json & .tmLanguage and are located in ./extensions/publisher.extension_name.version/syntaxes/*.
TODO: Explain basics of the Package.json in relation to TextMate syntaxes.
List of TextMate engines and their Regex engines:
- VSCode - TypeScript
- vscode-textmate v9.3.0
- vscode-oniguruma v1.7.0
- oniguruma v6.9.8
- vscode-oniguruma v1.7.0
- vscode-textmate v9.3.0
- TextMate v2.0 - C++
- textmate/Onigmo v5.13.5
- k-takata/Onigmo v5.13.5
- oniguruma v5.9.2
- k-takata/Onigmo v5.13.5
- textmate/Onigmo v5.13.5
- GitHub
- Linguist
- Lightshow/PrettyLights
- PCRE v8.36
- Pygments
- NovaLightshow - JavaScript
- ShikiJS - TypeScript
- Eclipse TM4E - Java
- KotlinTextMate - Kotlin
- codroid-textmate - Kotlin
- Atom - JavaScript
- First Mate v7.4.3
- node-oniguruma v7.2.3
- oniguruma v5.9.6
- node-oniguruma v7.2.3
- First Mate v7.4.3
- Arust-textmate - Rust
- Ferroni - Rust
- tmengine - Python
- textmate-highlight - Python
- textfriend - Python
- gopher-textmate - Go
regex.tmLanguage.json.
\\K Keep effectively moves the start position of the captured text.
\\G MatchAnchor matches against the end of a begin rule.
Capture groups inside a positive-lookaround can be targeted by capture.
Capture groups inside a negative-lookaround will cause an error. Use non-capture group (?:...) instead.
embedded-languages
Todo:
- Guides
- VSCode syntax-highlight-guide
- VSCode embedded-languages-guide
- TextMate 1.0 manual
- TextMate 2.0 manual
- Writing a TextMate Grammar: Some Lessons Learned
- How to create syntax highlighting for VSCode
- Building a syntax highlighting extension for VS Code
- A guide to writing a language grammar (TextMate) in Atom
- TextMate grammar guide
- Scope Naming
- Syntax Naming Conventions
- Naming conventions for syntax scopes
- Introducing Iro
- Iro documentation
- Resources
- VSCode TextMate Oniguruma regex syntax
- TextMate Language Grammars
- VSCode textmate_while
- VSCode Markdown Fenced Code Block Grammar Injection Example
- language-sampleGrammar.cson
- Regular Expressions Quick Reference
- Test your textmate grammars in TextMate
- Github List: VSCode TextMate Grammar Tools
- VSCode TmLanguage-Syntax-Highlighter Extension
- VSCode Extensions repo
- VSCode JSON Grammar
- Github theme scope-previews
- Testers
- vscode-syntax-highlighting-tester Steffeeen
- textmate-grammar-test serkonda7
- vscode-tmgrammar-test PanAeon
- textmate-validate carlwr
- Playgrounds
- NovaLightshow Nixinova
- textmate-grammars-themes Shiki
- phikiphp Phiki
- oniguruma-to-es Slevithan
- oniguruma-parser Slevithan
- textmate-grammar-playground Youngspe
- tmLanguage-Playground Kermanx
- Linguist-Demo DecimalTurn
- tmTheme-Editor Aziz
- textmate-syntax-playground TheTarnav
- Iro Consoli
- TextMate Grammar Testing Tool Leskoff
- Bugs
- Empty end matches \uFFFF
- include grammars don't load within captures
- Behaviour of begin/end and while patterns do not match TextMate
- Wrong backreference escaping
- \G matches unicode character 0xFFFF �
- JSON key "id" breaks the tokenizer
- JSON grammar without filePath parsed incorrectly as PList
- Scopes on Recursive Regex Cause Problems
- Textmate engine bug for \k<> backreferences
- Scoping Issues For Relative Rule References
- Absolute rule reference use local scope
- Capturing and applying a pattern causes performance loss
- Repository works only when it defined at top level of grammar file
- multiply applied capture groups seems to ignore some captures
- injections to not cover forward scoped regions
- possible unexpected behavior from capture sub-patterns (sub-tokenized capture)
- TextMate scope selectors: scope exclusion is not implemented
- Format strings not being handled in grammar
- VSCode's tmLanguage support cannot match zero-width begin and end correctly.