diff --git a/CHANGELOG.md b/CHANGELOG.md index 69c6f24..f497267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog] (http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +### [1.2.0] - 2023-11-06 +- Added support for mysql by allowing a space after -- + +### [1.1.0] - 2019-06-04 +- Added support for f-strings + ### [1.0.0] - 2019-03-29 - Added snippet and keybinding diff --git a/README.md b/README.md index fb7bff9..0cc04c1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Install `python-string-sql` from extensions (`ctrl + shift + x` or `cmd + shift ## Usage -Insert `--sql`, `--beginsql`, or `--begin-sql` at the beginning of the part of the string you would like highlighted and a semicolon, `--endsql`, or `--end-sql` at the end of the highlighted section. +Insert `--sql`, `--beginsql`, or `--begin-sql` at the beginning of the part of the string you would like highlighted (with or without a space after --, e.g. `-- sql`) and a semicolon, `--endsql`, or `--end-sql` at the end of the highlighted section. ### Snippets begin typing `sql` and the autocomplete snippet will appear: @@ -41,6 +41,12 @@ SELECT ## Release Notes +### [1.2.0] - 2023-11-06 +- Added support for mysql by allowing a space after -- + +### [1.1.0] - 2019-06-04 +- Added support for f-strings + ### [1.0.0] - 2019-03-29 - Added snippet and keybinding diff --git a/docs/python-string-sql-1.1.0.vsix b/docs/python-string-sql-1.1.0.vsix new file mode 100644 index 0000000..14a230d Binary files /dev/null and b/docs/python-string-sql-1.1.0.vsix differ diff --git a/package-lock.json b/package-lock.json index d03ed8e..31acf09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { "name": "python-string-sql", - "version": "1.0.0", + "version": "1.2.0", "lockfileVersion": 1 } diff --git a/package.json b/package.json index 24c879e..acdcf19 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "python-string-sql", "displayName": "python-string-sql", "description": "highlight python strings as sql", - "version": "1.0.0", + "version": "1.2.0", "publisher": "ptweir", "icon": "docs/logo.png", "repository": { @@ -21,11 +21,23 @@ "path": "./syntaxes/highlight-sql-string.json", "scopeName": "python-sql.injection", "injectTo": [ - "source.python" + "source.python", + "source.coconut" ], "embeddedLanguages": { "meta.embedded.sql": "sql" } + }, + { + "path": "./syntaxes/highlight-html-string.json", + "scopeName": "python-html.injection", + "injectTo": [ + "source.python", + "source.coconut" + ], + "embeddedLanguages": { + "meta.embedded.block.html": "html" + } } ], "snippets": [ @@ -41,7 +53,7 @@ "mac": "ctrl+s", "when": "editorTextFocus", "args": { - "langId": "python", + "langId": ["python", "coconut"], "name": "SQL_highlighted_string" } } diff --git a/syntaxes/highlight-html-string.json b/syntaxes/highlight-html-string.json new file mode 100644 index 0000000..aecaf03 --- /dev/null +++ b/syntaxes/highlight-html-string.json @@ -0,0 +1,60 @@ +{ + "fileTypes": [ + "py", + "coc", + "coco", + "coconut" + ], + "injectionSelector": "L:string.quoted.multi.python, L:meta.fstring.python - (comment.line.number-sign.python, punctuation.definition.comment.python)", + "repository": { + "keep-variables": { + "patterns": [ + { + "begin": "\\{", + "end": "\\}", + "beginCaptures": { + "1": { + "name": "punctuation.section.embedded.begin.py" + }, + "2": { + "name": "punctuation.section.embedded" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.section.embedded.end.py" + }, + "2": { + "name": "punctuation.section.embedded" + } + }, + "patterns": [ + { + "include": "text.html.derivative" + } + ] + } + ] + } + }, + "patterns": [ + { + "begin": "( *--html| *--beginhtml| *--begin-html)", + "end": "( *--\\!html| *--endhtml| *--end-html)", + "captures": { + "1": { + "name": "variable.parameter" + } + }, + "patterns": [ + { + "include": "text.html.derivative" + }, + { + "include": "#keep-variables" + } + ] + } + ], + "scopeName": "python-html.injection" +} diff --git a/syntaxes/highlight-sql-string.json b/syntaxes/highlight-sql-string.json index e044fcd..0ad1aab 100644 --- a/syntaxes/highlight-sql-string.json +++ b/syntaxes/highlight-sql-string.json @@ -1,12 +1,15 @@ { "fileTypes": [ - "py" + "py", + "coc", + "coco", + "coconut" ], "injectionSelector": "L:string.quoted.multi.python, L:meta.fstring.python - (comment.line.number-sign.python, punctuation.definition.comment.python)", "patterns": [ { - "begin": "(--sql|--beginsql|--begin-sql)", - "end": "(;|--endsql|--end-sql)", + "begin": "( *--sql| *--beginsql| *--begin-sql| *-- sql| *-- beginsql| *-- begin-sql)", + "end": "( *;| *--endsql| *--end-sql| * ;| *-- endsql| *-- end-sql)", "captures": { "1": { "name": "variable.parameter" @@ -20,4 +23,4 @@ } ], "scopeName": "python-sql.injection" -} \ No newline at end of file +}