Sign in Join
Wiki copytemporary

SynEdit Highlighter TextMate: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11> **Note:** This page is about the TSynTextMateSyn Highlighter in SynEdit and in the IDE.
22
33> **Note:** Lazarus 3.99 and up only
44
55__toc__
66
77# About
88
99SynEdit supports highlighting based on TextMate grammar (as also used by VSCode).
1010
1111# Supported Grammar
1212
1313The general documentation can be found with the TextMate project.
1414
1515## Match
1616
1717Patterns defined using "Match" should fully work.
1818
1919## Begin , End
2020
2121Patterns defined using "Begin" / "End" should fully work.
2222
2323### applyEndPatternLast
2424
2525Should work.
2626
2727### Back-references in "End" patterns
2828
2929According to the documentation those shall refer to capture groups in the "Begin" pattern.
3030
3131This feature has experimental support.
3232
3333## ~~While~~
3434
3535Patterns defined using "while" / "end" will be accepted, but may not work. The original project supplies no documentation about them (other than that they exist).
3636
3737## Captures
3838
3939Should work. The original project supplies no documentation on resolving conflicts. There may be differences in behaviour.
4040
4141## Regular expressions
4242
4343Are based on TRegExpr (as in the fpc distro, but updated).
4444
4545# Adapting an existing Grammar
4646
4747The below list is work in progress. Issue may/will be discovered/documented/fixed as the feature gets used.
4848
4949## "sampleText":
5050
5151For the IDE color configurator:
5252
53-`   {`\
54-`      "sampleText": "dorem ipsum foo bar"`\
55-`   }`
53+```text
54+ {
55+ "sampleText": "dorem ipsum foo bar"
56+ }
57+```
5658
5759## unsupported regex
5860
5961The HL will return errors for them. The IDE can display them in Tools \> Options: Editor \> Display \> Color \> TML Setup
6062
6163\- \[:alpha:\] style groups are not supported
6264
6365\- Unicode features are limited/unavailable (depends on support by TRegExpr, when compiled for non-widestring).
6466
6567## Replacing "while" patterns
6668
6769As needed...
6870
6971## Color names / Scopes
7072
7173The IDE will display a configuration for each individual scope.
7274
7375Unlike VSCode a color can not be defined for multiple scopes at once by matching them. It is therefore advisable to reduce the amount of scopes to whatever is really needed.
7476
7577Some grammar may have different scope names for opening/closing brackets (or quotes). This interferes with SynEdits logic, which insists that matchig brackets (for highlighting, when at caret) must have the same scope. Scopes for open/closing brackets/quotes/... should be changed to have the same name.
7678
7779# IDE
7880
7981To use a grammar file in the IDE copy it into the subfolder userschemes/tml in the primary-config-path.
8082
8183The IDE will list the files under Tools \> Options: Editor \> Display \> Color \> TML Setup - Part 1: files currently loaded and active. - Part 2: files currently in the folder.
8284
8385The active files (that can be chosen as HL) will only be loaded at IDE startup.
8486
8587The "Reload" button will reload the files in the folder, but **not** make them active. It will merely show if they could be parsed, or do have errors. Once errors are removed the IDE must be restarted to use them.
8688
8789---
8890*From the Free Pascal wiki, page "SynEdit Highlighter TextMate", as it stood on 2023-11-24 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
8991Category: SynEdit

Back to history