Skip to content

Commit

Permalink
feat: support ts-tags and lit
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 26, 2024
1 parent 8b29049 commit e4e9394
Show file tree
Hide file tree
Showing 13 changed files with 857 additions and 19 deletions.
27 changes: 27 additions & 0 deletions packages/tm-grammars/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,33 @@ SPDX: Apache-2.0
See the License for the specific language governing permissions and
limitations under the License.

=========================================================================================================
Files: es-tag-css.json, es-tag-glsl.json, es-tag-html.json, es-tag-sql.json, es-tag-xml.json
License: https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE
SPDX: MIT
---------------------------------------------------------------------------------------------------------
MIT License

Copyright (c) 2018 Tobimori (Victor Novikov)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

=========================================================================================================
Files: fennel.json
License: https://raw.githubusercontent.com/kongeor/vsc-fennel/master/LICENSE
Expand Down
6 changes: 6 additions & 0 deletions packages/tm-grammars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ import { grammars } from 'tm-grammars'
| `terraform` | `tf` `tfvars` | [hashicorp/syntax](https://github.com/hashicorp/syntax/blob/c693badea4d460d1c05b8d2ab0c88bad143da3f1/syntaxes/terraform.tmGrammar.json) | [MPL-2.0](https://raw.githubusercontent.com/hashicorp/syntax/main/LICENSE) | | 12.58 kB |
| `tex` | | [microsoft/vscode](https://github.com/microsoft/vscode/blob/b8e3432a0b7dd11ffd0c832fad6a6c51e809013c/extensions/latex/syntaxes/TeX.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | `r` | 8.77 kB |
| `toml` | | [textmate/toml.tmbundle](https://github.com/textmate/toml.tmbundle/blob/e82b64c1e86396220786846201e9aa3f0a2d9ca2/Syntaxes/TOML.tmLanguage) | | | 6.26 kB |
| `ts-embed` | `lit` | - | | `typescript` | 126.00 B |
| `tsv` | | [mechatroner/vscode_rainbow_csv](https://github.com/mechatroner/vscode_rainbow_csv/blob/00d4c947f1bbe6a4a73599bd97fb31bdfbe262f3/syntaxes/tsv.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/mechatroner/vscode_rainbow_csv/master/LICENSE) | | 633.00 B |
| `tsx` | | [microsoft/vscode](https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/typescript-basics/syntaxes/TypeScriptReact.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | | 171.16 kB |
| `turtle` | | [stardog-union/stardog-vsc](https://github.com/stardog-union/stardog-vsc/blob/3f1364b08bdbf4b4d77f123682db7d2b708b2f6e/stardog-rdf-grammars/syntaxes/turtle.tmLanguage.json) | | | 3.50 kB |
Expand Down Expand Up @@ -243,6 +244,11 @@ Injections are grammars that are embedded in other grammars. They are used to ag
| `angular-template` | | [angular/vscode-ng-language-service](https://github.com/angular/vscode-ng-language-service/blob/28739e438742bee69faceda5fd15445682451397/syntaxes/template.json) | [MIT](https://raw.githubusercontent.com/angular/vscode-ng-language-service/main/LICENSE) | `angular-expression` | 471.00 B |
| `angular-template-blocks` | | [angular/vscode-ng-language-service](https://github.com/angular/vscode-ng-language-service/blob/b424eaa01e3cb5600bfe65ce7232a72c7d452d19/syntaxes/template-blocks.json) | [MIT](https://raw.githubusercontent.com/angular/vscode-ng-language-service/main/LICENSE) | `angular-expression` `angular-template` | 1.18 kB |
| `cpp-macro` | | [microsoft/vscode](https://github.com/microsoft/vscode/blob/6ac83c7c7dda9f27ca1fe9d98675253e010b75d1/extensions/cpp/syntaxes/cpp.embedded.macro.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | `regexp` `glsl` `sql` | 230.05 kB |
| `es-tag-css` | | [0x00000001A/es6-string-html](https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-css.json) | [MIT](https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE) | `typescript` `css` `javascript` | 1.67 kB |
| `es-tag-glsl` | | [0x00000001A/es6-string-html](https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-glsl.json) | [MIT](https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE) | `typescript` `glsl` `javascript` | 1.55 kB |
| `es-tag-html` | | [0x00000001A/es6-string-html](https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-html.json) | [MIT](https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE) | `typescript` `html` `javascript` | 1.86 kB |
| `es-tag-sql` | | [0x00000001A/es6-string-html](https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-sql.json) | [MIT](https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE) | `typescript` `sql` | 1.47 kB |
| `es-tag-xml` | | [0x00000001A/es6-string-html](https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-xml.json) | [MIT](https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE) | `xml` | 1.07 kB |
| `jinja-html` | | [samuelcolvin/jinjahtml-vscode](https://github.com/samuelcolvin/jinjahtml-vscode/blob/64ad369cd167bba2e614944db6d925b7dc6483b4/syntaxes/jinja-html.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/samuelcolvin/jinjahtml-vscode/main/LICENSE) | `html` | 470.00 B |
| `markdown-vue` | | [vuejs/language-tools](https://github.com/vuejs/language-tools/blob/e23ff4d13001ffe78d893bb707d839ead29e0e40/extensions/vscode/syntaxes/markdown-vue.json) | [MIT](https://raw.githubusercontent.com/vuejs/language-tools/master/LICENSE) | | 684.00 B |
| `vue-directives` | | [vuejs/language-tools](https://github.com/vuejs/language-tools/blob/d5ab9edcf4a18d9c25c143a37cc3ec95229fc6b1/extensions/vscode/syntaxes/vue-directives.json) | [MIT](https://raw.githubusercontent.com/vuejs/language-tools/master/LICENSE) | | 366.00 B |
Expand Down
118 changes: 118 additions & 0 deletions packages/tm-grammars/grammars/es-tag-css.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"fileTypes": [
"js",
"jsx",
"ts",
"tsx",
"html",
"vue",
"svelte",
"php",
"res"
],
"injectTo": [
"source.ts",
"source.js"
],
"injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string, L:source.vue -comment -string, L:source.svelte -comment -string, L:source.php -comment -string, L:source.rescript -comment -string",
"injections": {
"L:source": {
"patterns": [
{
"match": "<",
"name": "invalid.illegal.bad-angle-bracket.html"
}
]
}
},
"name": "es-tag-css",
"patterns": [
{
"begin": "(?i)(\\s?\\/\\*\\s?(css|inline-css)\\s?\\*\\/\\s?)(`)",
"beginCaptures": {
"1": {
"name": "comment.block"
}
},
"end": "(`)",
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.css"
},
{
"include": "inline.es6-htmlx#template"
}
]
},
{
"begin": "(?i)(\\s*(css|inline-css))(`)",
"beginCaptures": {
"1": {
"name": "comment.block"
}
},
"end": "(`)",
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.css"
},
{
"include": "inline.es6-htmlx#template"
},
{
"include": "string.quoted.other.template.js"
}
]
},
{
"begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(css|inline-css)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$",
"beginCaptures": {
"1": {
"name": "comment.line"
}
},
"end": "(`).*",
"patterns": [
{
"begin": "(\\G)",
"end": "(`)"
},
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.css"
}
]
},
{
"begin": "(\\${)",
"beginCaptures": {
"1": {
"name": "entity.name.tag"
}
},
"end": "(})",
"endCaptures": {
"1": {
"name": "entity.name.tag"
}
},
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.js"
}
]
}
],
"scopeName": "inline.es6-css"
}
118 changes: 118 additions & 0 deletions packages/tm-grammars/grammars/es-tag-glsl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"fileTypes": [
"js",
"jsx",
"ts",
"tsx",
"html",
"vue",
"svelte",
"php",
"res"
],
"injectTo": [
"source.ts",
"source.js"
],
"injectionSelector": "L:source.js -comment -string, L:source.js -comment -string, L:source.jsx -comment -string, L:source.js.jsx -comment -string, L:source.ts -comment -string, L:source.tsx -comment -string, L:source.rescript -comment -string",
"injections": {
"L:source": {
"patterns": [
{
"match": "<",
"name": "invalid.illegal.bad-angle-bracket.html"
}
]
}
},
"name": "es-tag-glsl",
"patterns": [
{
"begin": "(?i)(\\s?\\/\\*\\s?(glsl|inline-glsl)\\s?\\*\\/\\s?)(`)",
"beginCaptures": {
"1": {
"name": "comment.block"
}
},
"end": "(`)",
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.glsl"
},
{
"include": "inline.es6-htmlx#template"
}
]
},
{
"begin": "(?i)(\\s*(glsl|inline-glsl))(`)",
"beginCaptures": {
"1": {
"name": "comment.block"
}
},
"end": "(`)",
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.glsl"
},
{
"include": "inline.es6-htmlx#template"
},
{
"include": "string.quoted.other.template.js"
}
]
},
{
"begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(glsl|inline-glsl)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$",
"beginCaptures": {
"1": {
"name": "comment.line"
}
},
"end": "(`).*",
"patterns": [
{
"begin": "(\\G)",
"end": "(`)"
},
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.glsl"
}
]
},
{
"begin": "(\\${)",
"beginCaptures": {
"1": {
"name": "entity.name.tag"
}
},
"end": "(})",
"endCaptures": {
"1": {
"name": "entity.name.tag"
}
},
"patterns": [
{
"include": "source.ts#template-substitution-element"
},
{
"include": "source.js"
}
]
}
],
"scopeName": "inline.es6-glsl"
}
Loading

0 comments on commit e4e9394

Please sign in to comment.