├── .gitattributes ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── package.json ├── syntaxes └── lit-sql.json ├── test.js └── vscode └── launch.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Forbes Lindesay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vscode-sql-template-literal 2 | 3 | Syntax highlighting for code like: 4 | 5 | ```js 6 | const query = sql`SELECT * FROM users`; 7 | ``` 8 | 9 | ## Publishing 10 | 11 | May require token, stored in last pass. Go to 12 | https://forbeslindesay.visualstudio.com/_details/security/tokens if token needs 13 | regenerating. 14 | 15 | ``` 16 | npm install -g vsce 17 | vsce publish 18 | ``` 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-sql-template-literal", 3 | "displayName": "vscode-sql-template-literal", 4 | "description": "Syntax highlighting for sql in template literals", 5 | "version": "0.1.0", 6 | "publisher": "forbeslindesay", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/ForbesLindesay/vscode-sql-template-literal.git" 11 | }, 12 | "engines": { 13 | "vscode": "^1.5.0" 14 | }, 15 | "categories": [ 16 | "Languages" 17 | ], 18 | "contributes": { 19 | "grammars": [ 20 | { 21 | "injectTo": [ 22 | "source.js", 23 | "source.js.jsx", 24 | "source.jsx", 25 | "source.ts", 26 | "source.tsx" 27 | ], 28 | "scopeName": "inline.lit-sql", 29 | "path": "./syntaxes/lit-sql.json", 30 | "embeddedLanguages": { 31 | "meta.embedded.block.sql": "sql" 32 | } 33 | } 34 | ] 35 | } 36 | } -------------------------------------------------------------------------------- /syntaxes/lit-sql.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [], 3 | "injectionSelector": "L:source -comment -string", 4 | "patterns": [ 5 | { 6 | "name": "taggedTemplates", 7 | "contentName": "meta.embedded.block.sql", 8 | "begin": "sql((`))", 9 | "beginCaptures": { 10 | "1": { 11 | "name": "entity.name.function.tagged-template.js" 12 | }, 13 | "2": { 14 | "name": "string.js" 15 | }, 16 | "3": { 17 | "name": "punctuation.definition.string.template.begin.js" 18 | } 19 | }, 20 | "end": "(`)", 21 | "endCaptures": { 22 | "0": { 23 | "name": "string.js" 24 | }, 25 | "1": { 26 | "name": "punctuation.definition.string.template.end.js" 27 | } 28 | }, 29 | "patterns": [ 30 | { 31 | "include": "source.ts#template-substitution-element" 32 | }, 33 | { 34 | "include": "source.sql" 35 | } 36 | ] 37 | } 38 | ], 39 | "scopeName": "inline.lit-sql" 40 | } 41 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | const query = sql`SELECT * FROM users`; 2 | -------------------------------------------------------------------------------- /vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Extension", 6 | "type": "extensionHost", 7 | "request": "launch", 8 | "runtimeExecutable": "${execPath}", 9 | "args": ["--extensionDevelopmentPath=${workspaceFolder}"] 10 | } 11 | ] 12 | } 13 | --------------------------------------------------------------------------------