Skip to content

Commit

Permalink
[TASK] Add support for .tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Jul 27, 2018
1 parent 42d4dd0 commit 1818649
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# vscode-typo3-typoscript
An extension for VS Code which provides support for the TypoScript syntax.
An extension for VS Code which provides support for the TypoScript and TsConfig syntax.
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,29 @@
"setup.txt"
],
"configuration": "./language-configuration.json"
},
{
"id": "tsconfig",
"aliases": [
"TsConfig",
"tsconfig"
],
"extensions": [
".tsconfig"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "typoscript",
"scopeName": "source.typoscript",
"path": "./syntaxes/typoscript.tmLanguage.json"
},
{
"language": "tsconfig",
"scopeName": "source.tsconfig",
"path": "./syntaxes/tsconfig.tmLanguage.json"
}
]
}
Expand Down
217 changes: 217 additions & 0 deletions syntaxes/tsconfig.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "TsConfig",
"patterns": [
{
"include": "#comments"
},
{
"include": "#includes"
},
{
"include": "#conditions"
},
{
"comment": "Everything after the equal sign",
"begin": "(=)(\\s?)",
"captures": {
"0": {
"name": "keyword.operator"
}
},
"end": "(?:\n|$)",
"name": "string.interpolated.tsconfig",
"patterns": [
{
"include": "#cobjects"
},
{
"include": "#constants"
},
{
"include": "#interpolation"
},
{
"include": "#strings"
}
]
}
],
"repository": {
"comments": {
"patterns": [
{
"begin": "/\\*",
"captures": {
"0": {
"name": "punctuation.definition.comment.tsconfig"
}
},
"end": "\\*/",
"name": "comment.block.tsconfig"
},
{
"begin": "(^\\s+)?(?=//)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.tsconfig"
}
},
"end": "(?!\\G)",
"patterns": [
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.tsconfig"
}
},
"end": "\\n|(?=\\?>)",
"name": "comment.line.double-slash.tsconfig"
}
]
},
{
"begin": "(^\\s+)?(?=#)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.tsconfig"
}
},
"end": "(?!\\G)",
"patterns": [
{
"begin": "#",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.tsconfig"
}
},
"end": "\\n|(?=\\?>)",
"name": "comment.line.number-sign.tsconfig"
}
]
}
]
},
"constants": {
"patterns": [
{
"name": "variable.other.tsconfig",
"match": "{\\$.*}"
}
]
},
"conditions": {
"patterns": [
{
"name": "variable.other.tsconfig",
"match": "\\[(adminUser|language|IP|hostname|applicationContext|hour|minute|month|year|dayofweek|dayofmonth|dayofyear|usergroup|loginUser|page|treeLevel|PIDinRootline|PIDupinRootline|compatVersion|globalVar|globalString|global|userFunc|end|((?:\\{1,2}\\w+|\\w+\\\\{1,2})(?:\\w+\\\\{0,2})+)).*\\]"
}
]
},
"cobjects": {
"patterns": [
{
"name": "support.class.cobject.tsconfig",
"match": "(CASE|COA|COA_INT|CONTENT|EDITPANEL|FILE|FILES|FLUIDTEMPLATE|HMENU|TMENU|IMAGE|IMG_RESOURCE|LOAD_REGISTER|RECORDS|RESTORE_REGISTER|SVG|TEMPLATE|TEXT|USER|USER_INT|PAGE)\\b(?:\n|$)"
}
]
},
"interpolation": {
"patterns": [
{
"match": "\\\\[0-7]{1,3}",
"name": "constant.numeric.octal.tsconfig"
},
{
"match": "\\\\x[0-9A-Fa-f]{1,2}",
"name": "constant.numeric.hex.tsconfig"
},
{
"match": "\\\\[enrt\\\\\\$\\\"]",
"name": "constant.character.escape.tsconfig"
}
]
},
"string-double-quoted": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.tsconfig"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.tsconfig"
}
},
"name": "string.quoted.double.tsconfig",
"patterns": [
{
"include": "#interpolation"
}
]
},
"string-single-quoted": {
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.tsconfig"
}
},
"end": "'",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.tsconfig"
}
},
"name": "string.quoted.single.tsconfig",
"patterns": [
{
"match": "\\\\[\\\\']",
"name": "constant.character.escape.tsconfig"
}
]
},
"strings": {
"patterns": [
{
"include": "#string-double-quoted"
},
{
"include": "#string-single-quoted"
}
]
},
"includes": {
"patterns": [
{
"begin": "<INCLUDE_tsconfig:",
"beginCaptures": {
"0": {
"name": "support.function.tsconfig"
}
},
"end": ">",
"endCaptures": {
"0": {
"name": "support.function.tsconfig"
}
},
"patterns": [
{
"name": "variable.parameter.tsconfig",
"match": "(source|extensions|condition)(=)"
},
{
"include": "#strings"
}
]
}
]
}
},
"scopeName": "source.tsconfig"
}

0 comments on commit 1818649

Please sign in to comment.