1

I would like to create my syntax for VS code, expanding the TypeScript one.

This is my tmlanguage.json created with yo code helper:

{
    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
    "name": "mylang",
    "patterns": [{
            "include": "source.ts"
        },
        {
            "include": "#keywords"
        },
        {
            "include": "#strings"
        },
        {
            "include": "#htmlTags"
        }
    ],
    "repository": {
        "keywords": {
            "patterns": [{
                "name": "keyword.control.htmlscript",
                "match": "\\b(if|while|for|return)\\b"
            }]
        },
        "htmlTags": {
            "patterns": [{
                "name": "variable.language",
                "match": "(div|text)"
            }]
        },
        "strings": {
            "name": "string.quoted.double.mylang",
            "begin": "\"",
            "end": "\"",
            "patterns": [{
                "name": "constant.character.escape.mylang",
                "match": "\\\\."
            }]
        }
    },
    "scopeName": "source.mylang"
}

This, without "include": "source.ts" work well, I added this include to show TypeScript syntax. After adding it, it only recognizes TypeScript code and not mine.

Why? Anybody did something similar?

Gama11
  • 31,714
  • 9
  • 78
  • 100
marco burrometo
  • 1,055
  • 3
  • 16
  • 33

0 Answers0