diff --git a/packages/tm-grammars/NOTICE b/packages/tm-grammars/NOTICE index 8e9b404..f330ee7 100644 --- a/packages/tm-grammars/NOTICE +++ b/packages/tm-grammars/NOTICE @@ -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 diff --git a/packages/tm-grammars/README.md b/packages/tm-grammars/README.md index 35319e6..adae3b9 100644 --- a/packages/tm-grammars/README.md +++ b/packages/tm-grammars/README.md @@ -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 | @@ -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 | diff --git a/packages/tm-grammars/grammars/es-tag-css.json b/packages/tm-grammars/grammars/es-tag-css.json new file mode 100644 index 0000000..0bc0d43 --- /dev/null +++ b/packages/tm-grammars/grammars/es-tag-css.json @@ -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" +} diff --git a/packages/tm-grammars/grammars/es-tag-glsl.json b/packages/tm-grammars/grammars/es-tag-glsl.json new file mode 100644 index 0000000..a9594db --- /dev/null +++ b/packages/tm-grammars/grammars/es-tag-glsl.json @@ -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" +} diff --git a/packages/tm-grammars/grammars/es-tag-html.json b/packages/tm-grammars/grammars/es-tag-html.json new file mode 100644 index 0000000..c462d85 --- /dev/null +++ b/packages/tm-grammars/grammars/es-tag-html.json @@ -0,0 +1,140 @@ +{ + "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-html", + "patterns": [ + { + "begin": "(?i)(\\s?\\/\\*\\s?(html|template|inline-html|inline-template)\\s?\\*\\/\\s?)(`)", + "beginCaptures": { + "1": { + "name": "comment.block" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "text.html.basic" + }, + { + "include": "inline.es6-htmlx#template" + } + ] + }, + { + "begin": "(?i)(\\s*(html|template|inline-html|inline-template))(`)", + "beginCaptures": { + "1": { + "name": "comment.block" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "text.html.basic" + }, + { + "include": "inline.es6-htmlx#template" + }, + { + "include": "string.quoted.other.template.js" + } + ] + }, + { + "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(html|template|inline-html|inline-template)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", + "beginCaptures": { + "1": { + "name": "comment.line" + } + }, + "end": "(`).*", + "patterns": [ + { + "begin": "(\\G)", + "end": "(`)" + }, + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "text.html.basic" + } + ] + }, + { + "begin": "(\\${)", + "beginCaptures": { + "1": { + "name": "entity.name.tag" + } + }, + "end": "(})", + "endCaptures": { + "1": { + "name": "entity.name.tag" + } + }, + "patterns": [ + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "source.js" + } + ] + }, + { + "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-html" +} diff --git a/packages/tm-grammars/grammars/es-tag-sql.json b/packages/tm-grammars/grammars/es-tag-sql.json new file mode 100644 index 0000000..93f866f --- /dev/null +++ b/packages/tm-grammars/grammars/es-tag-sql.json @@ -0,0 +1,114 @@ +{ + "fileTypes": [ + "js", + "jsx", + "ts", + "tsx", + "html", + "vue", + "svelte", + "php", + "res" + ], + "injectTo": [ + "source.ts", + "source.js" + ], + "injectionSelector": "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-sql", + "patterns": [ + { + "begin": "(?i)\\b(\\w+\\.sql)\\s*(`)", + "beginCaptures": { + "1": { + "name": "variable.parameter" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "source.ts#string-character-escape" + }, + { + "include": "source.sql" + }, + { + "include": "source.plpgsql.postgres" + }, + { + "match": "." + } + ] + }, + { + "begin": "(?i)(\\s?\\/?\\*?\\s?(sql|inline-sql)\\s?\\*?\\/?\\s?)(`)", + "beginCaptures": { + "1": { + "name": "comment.block" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "source.ts#string-character-escape" + }, + { + "include": "source.sql" + }, + { + "include": "source.plpgsql.postgres" + }, + { + "match": "." + } + ] + }, + { + "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(sql|inline-sql)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", + "beginCaptures": { + "1": { + "name": "comment.line" + } + }, + "end": "(`)", + "patterns": [ + { + "begin": "(\\G)", + "end": "(`)" + }, + { + "include": "source.ts#template-substitution-element" + }, + { + "include": "source.ts#string-character-escape" + }, + { + "include": "source.sql" + }, + { + "include": "source.plpgsql.postgres" + }, + { + "match": "." + } + ] + } + ], + "scopeName": "inline.es6-sql" +} diff --git a/packages/tm-grammars/grammars/es-tag-xml.json b/packages/tm-grammars/grammars/es-tag-xml.json new file mode 100644 index 0000000..b9eeb94 --- /dev/null +++ b/packages/tm-grammars/grammars/es-tag-xml.json @@ -0,0 +1,78 @@ +{ + "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-xml", + "patterns": [ + { + "begin": "(?i)(\\s?\\/\\*\\s?(xml|svg|inline-svg|inline-xml)\\s?\\*\\/\\s?)(`)", + "beginCaptures": { + "1": { + "name": "comment.block" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "text.xml" + } + ] + }, + { + "begin": "(?i)(\\s*(xml|inline-xml))(`)", + "beginCaptures": { + "1": { + "name": "comment.block" + } + }, + "end": "(`)", + "patterns": [ + { + "include": "text.xml" + } + ] + }, + { + "begin": "(?i)(?<=\\s|\\,|\\=|\\:|\\(|\\$\\()\\s{0,}(((\\/\\*)|(\\/\\/))\\s?(xml|svg|inline-svg|inline-xml)[ ]{0,1000}\\*?\\/?)[ ]{0,1000}$", + "beginCaptures": { + "1": { + "name": "comment.line" + } + }, + "end": "(`).*", + "patterns": [ + { + "begin": "(\\G)", + "end": "(`)" + }, + { + "include": "text.xml" + } + ] + } + ], + "scopeName": "inline.es6-xml" +} diff --git a/packages/tm-grammars/grammars/ts-embed.json b/packages/tm-grammars/grammars/ts-embed.json new file mode 100644 index 0000000..032aa7c --- /dev/null +++ b/packages/tm-grammars/grammars/ts-embed.json @@ -0,0 +1,10 @@ +{ + "displayName": "TypeScript with Embeds", + "name": "ts-embed", + "patterns": [ + { + "include": "source.ts" + } + ], + "scopeName": "source.ts.embeds" +} diff --git a/packages/tm-grammars/index.js b/packages/tm-grammars/index.js index 3442b26..8644f8d 100644 --- a/packages/tm-grammars/index.js +++ b/packages/tm-grammars/index.js @@ -2933,6 +2933,21 @@ export const grammars = [ sha: 'e82b64c1e86396220786846201e9aa3f0a2d9ca2', source: 'https://github.com/textmate/toml.tmbundle/blob/e82b64c1e86396220786846201e9aa3f0a2d9ca2/Syntaxes/TOML.tmLanguage', }, + { + aliases: [ + 'lit', + ], + byteSize: 126, + categories: [ + 'web', + ], + displayName: 'TypeScript with Embeds', + embedded: [ + 'typescript', + ], + name: 'ts-embed', + scopeName: 'source.ts.embeds', + }, { byteSize: 633, categories: [ @@ -3527,6 +3542,113 @@ export const injections = [ sha: '6ac83c7c7dda9f27ca1fe9d98675253e010b75d1', source: 'https://github.com/microsoft/vscode/blob/6ac83c7c7dda9f27ca1fe9d98675253e010b75d1/extensions/cpp/syntaxes/cpp.embedded.macro.tmLanguage.json', }, + { + byteSize: 1712, + embedded: [ + 'typescript', + 'css', + 'javascript', + ], + embeddedIn: [ + 'ts-tags', + ], + injectTo: [ + 'source.ts', + 'source.js', + ], + lastUpdate: '2024-05-10T19:00:53Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE', + name: 'es-tag-css', + scopeName: 'inline.es6-css', + sha: 'b8f51210b53ce64e789949d4be33b7ecb42cf177', + source: 'https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-css.json', + }, + { + byteSize: 1591, + embedded: [ + 'typescript', + 'glsl', + 'javascript', + ], + embeddedIn: [ + 'ts-tags', + ], + injectTo: [ + 'source.ts', + 'source.js', + ], + lastUpdate: '2024-05-10T19:00:53Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE', + name: 'es-tag-glsl', + scopeName: 'inline.es6-glsl', + sha: 'b8f51210b53ce64e789949d4be33b7ecb42cf177', + source: 'https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-glsl.json', + }, + { + byteSize: 1902, + embedded: [ + 'typescript', + 'html', + 'javascript', + ], + embeddedIn: [ + 'ts-tags', + ], + injectTo: [ + 'source.ts', + 'source.js', + ], + lastUpdate: '2024-05-10T19:00:53Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE', + name: 'es-tag-html', + scopeName: 'inline.es6-html', + sha: 'b8f51210b53ce64e789949d4be33b7ecb42cf177', + source: 'https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-html.json', + }, + { + byteSize: 1510, + embedded: [ + 'typescript', + 'sql', + ], + embeddedIn: [ + 'ts-tags', + ], + injectTo: [ + 'source.ts', + 'source.js', + ], + lastUpdate: '2024-05-10T19:00:53Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE', + name: 'es-tag-sql', + scopeName: 'inline.es6-sql', + sha: 'b8f51210b53ce64e789949d4be33b7ecb42cf177', + source: 'https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-sql.json', + }, + { + byteSize: 1098, + embedded: [ + 'xml', + ], + embeddedIn: [ + 'ts-tags', + ], + injectTo: [ + 'source.ts', + 'source.js', + ], + lastUpdate: '2024-05-10T19:00:53Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/0x00000001A/es6-string-html/master/LICENSE', + name: 'es-tag-xml', + scopeName: 'inline.es6-xml', + sha: 'b8f51210b53ce64e789949d4be33b7ecb42cf177', + source: 'https://github.com/0x00000001A/es6-string-html/blob/b8f51210b53ce64e789949d4be33b7ecb42cf177/syntaxes/es6-inline-xml.json', + }, { byteSize: 470, displayName: 'jinja-html', diff --git a/samples/ts-tags.sample b/samples/ts-tags.sample new file mode 100644 index 0000000..43e0174 --- /dev/null +++ b/samples/ts-tags.sample @@ -0,0 +1,49 @@ +import {LitElement, html, customElement, property} from 'lit-element'; + +const style = /* css */` + .foo { + display: block; + border: 1px solid black; + padding: 16px; + max-width: 800px; + margin: 0 auto; + } +`; + +@customElement('my-element') +class MyElement extends LitElement { + + // Declare observed properties + @property() + adjective = 'awesome'; + + // Define the element's template + render() { + return html` + +
${this.prop1}
+ + +
attribute binding
+ + +
+ boolean attribute binding + +
+ + +
+ property binding + +
+ + +
event handler binding + +
+ `; + } +} + +// from: https://lit.dev/docs/v1/components/decorators/ diff --git a/scripts/grammars/fetch.ts b/scripts/grammars/fetch.ts index 8d7b857..7c786ff 100644 --- a/scripts/grammars/fetch.ts +++ b/scripts/grammars/fetch.ts @@ -88,28 +88,37 @@ else { async function fetchGrammar(source: GrammarSource) { let raw: string - const old = oldMeta.find(i => i.name === source.name) - const info = await resolveSourceGitHub(source, old) - if (old === info) - return { info, skip: true } - - let fileUrl = info.source.toLowerCase() - - if (source.marketplace) { - const name = source.marketplace.grammar - const { json, zip } = await downloadFromMarketplace(source.marketplace.name) - const grammar = json.contributes.grammars.find((i: any) => i.language === name) - if (!grammar) - throw new Error(`Failed to find grammar ${name} in ${source.marketplace.name}`) - raw = String(zip.getEntry(grammar.path.replace('./', 'extension/'))!.getData()) - fileUrl = grammar.path + let parsed: any + let info: GrammarInfo = source as GrammarInfo + if (typeof source.source === 'function') { + parsed = await source.source() } else { - raw = await fetch(`${info.source}?raw=true`).then(r => r.text()) + const old = process.argv.includes(source.name) + ? undefined + : oldMeta.find(i => i.name === source.name) + info = await resolveSourceGitHub(source, old) + if (old === info) + return { info, skip: true } + + let fileUrl = info.source.toLowerCase() + + if (source.marketplace) { + const name = source.marketplace.grammar + const { json, zip } = await downloadFromMarketplace(source.marketplace.name) + const grammar = json.contributes.grammars.find((i: any) => i.language === name) + if (!grammar) + throw new Error(`Failed to find grammar ${name} in ${source.marketplace.name}`) + raw = String(zip.getEntry(grammar.path.replace('./', 'extension/'))!.getData()) + fileUrl = grammar.path + } + else { + raw = await fetch(`${info.source}?raw=true`).then(r => r.text()) + } + parsed = parseFile(fileUrl, raw) } try { - let parsed = parseFile(fileUrl, raw) // Apply custom patching function parsed = source.patch?.(parsed) || parsed // Update info @@ -140,7 +149,7 @@ export async function generateREADME(resolved: GrammarInfo[]) { return [ '| Name | Alias | Source | License | Deps On | File Size |', '| ---- | ----- | ------ | ------- | ------- | --------- |', - ...items.map(info => `| \`${info.name}\` | ${info.aliases?.map(i => `\`${i}\``).join(' ') || ''} | [${[parseGitHubUrl(info.source).repo]}](${info.source}) | ${info.licenseUrl ? `[${info.license}](${info.licenseUrl})` : ''} | ${info.embedded?.map(i => `\`${i}\``).join(' ') || ''} | ${fileSizeToHuman(info.byteSize)} |`), + ...items.map(info => `| \`${info.name}\` | ${info.aliases?.map(i => `\`${i}\``).join(' ') || ''} | ${typeof info.source === 'string' ? `[${[parseGitHubUrl(info.source).repo]}](${info.source})` : '-'} | ${info.licenseUrl ? `[${info.license}](${info.licenseUrl})` : ''} | ${info.embedded?.map(i => `\`${i}\``).join(' ') || ''} | ${fileSizeToHuman(info.byteSize)} |`), ] } const replaced = original.replace( diff --git a/scripts/grammars/types.ts b/scripts/grammars/types.ts index 79aea6b..22bf4d9 100644 --- a/scripts/grammars/types.ts +++ b/scripts/grammars/types.ts @@ -1,10 +1,12 @@ import type { GrammarCategory } from '../../packages/tm-grammars' +type Awaitable = Promise | T + export interface GrammarSource { name: string displayName?: string categories?: GrammarCategory[] - source: string + source: string | (() => Awaitable) aliases?: string[] scopeName?: string diff --git a/sources-grammars.ts b/sources-grammars.ts index 4e4386b..55b95b2 100644 --- a/sources-grammars.ts +++ b/sources-grammars.ts @@ -1123,6 +1123,20 @@ export const virtualLanguages: GrammarSource[] = [ categories: ['web'], scopeName: 'source.ts.ng', }, + { + name: 'ts-embed', + displayName: 'TypeScript with Embeds', + aliases: ['lit'], + source: () => ({ + patterns: [ + { + include: 'source.ts', + }, + ], + scopeName: 'source.ts.embeds', + }), + categories: ['web'], + }, ] /** @@ -1243,6 +1257,37 @@ export const sourcesInjections: GrammarSource[] = [ source: 'https://github.com/angular/vscode-ng-language-service/blob/main/syntaxes/expression.json', embeddedIn: ['angular-ts', 'angular-html'], }, + // ========== Lit ========== + { + name: 'es-tag-html', + source: 'https://github.com/0x00000001A/es6-string-html/blob/master/syntaxes/es6-inline-html.json', + embeddedIn: ['ts-embed'], + injectTo: ['source.ts', 'source.js'], + }, + { + name: 'es-tag-css', + source: 'https://github.com/0x00000001A/es6-string-html/blob/master/syntaxes/es6-inline-css.json', + embeddedIn: ['ts-embed'], + injectTo: ['source.ts', 'source.js'], + }, + { + name: 'es-tag-glsl', + source: 'https://github.com/0x00000001A/es6-string-html/blob/master/syntaxes/es6-inline-glsl.json', + embeddedIn: ['ts-embed'], + injectTo: ['source.ts', 'source.js'], + }, + { + name: 'es-tag-sql', + source: 'https://github.com/0x00000001A/es6-string-html/blob/master/syntaxes/es6-inline-sql.json', + embeddedIn: ['ts-embed'], + injectTo: ['source.ts', 'source.js'], + }, + { + name: 'es-tag-xml', + source: 'https://github.com/0x00000001A/es6-string-html/blob/master/syntaxes/es6-inline-xml.json', + embeddedIn: ['ts-embed'], + injectTo: ['source.ts', 'source.js'], + }, ] export const sources = [