Author Topic: Configurable Highlighter support (textmate grammar) -- Testers needed  (Read 8153 times)


  • Administrator
  • Hero Member
  • *
  • Posts: 10086
  • Debugger - SynEdit - and more
    • wiki
The IDE can now load highlighter definition files containing textmate grammar. (mostly).
EDIT: IDE => Lazarus 3.99

There are some items still missing
- nested grammar/language (include using a 2nd grammar) (todo)
- folding (todo)
- There is also no support for "injections" (just edit the grammar and copy the injection into the final place).

Known differences:
- The regex engine does not support the full range of operations. So some existing grammars may fail on that (or behave different).
- SynEdit does not store newlines chars => patterns matching "\n" must be changed to match "$" instead.


- Add the json file to PCP/usersessions/tml/
  Files will be loaded at IDE startup. IDE must be restarted to load new files.
- The IDE will show it in the highlighter list
  Or it will show it on the "color tml" page, if there is an error in the file

It is recommanded to edit/amend the files (if you copy existing grammars).
- to get text in the preview of the options, add (top level) either
  "sampleText": "foo bar some text"
  "sampleTextFile": "/foo/bar/file"
- simplify the naming. Existing files contain name like
          "name": "comment.block.pascal",
          "name": "comment.line.pascal",
  You may want to replace them, with one name for all comments (keep one dot, as it will detect "comment.*" for default colors).
          "name": "comment.pascal",

Please test (if interested in the feature). Thanks

« Last Edit: September 12, 2023, 06:42:31 pm by Martin_fr »


  • Administrator
  • Hero Member
  • *
  • Posts: 10086
  • Debugger - SynEdit - and more
    • wiki
Re: Configurable Highlighter support (textmate grammar) -- Testers needed
« Reply #1 on: September 12, 2023, 06:41:44 pm »
Where is "this file"?

Which "this file"?

The IDE: You need to use git, to get the latest revision from the main branch, then build it (or use fpupDeluxe)

The "grammar/json files": You can write your own, or look at those shipped with textmate or vscode. (Currently only some of those pre-existing files are supported / work in progress) (and various other pages)

The installation location: In the primary config path and then in userschemes/tml.
With the updated IDE, in the option dialog is a page that shows a list of grammars found. That page also gives the resolved path.


TinyPortal © 2005-2018