diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..9c9f108 Binary files /dev/null and b/.DS_Store differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e0e112..37f4364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,14 @@ 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.1.0] - 2019-06-04 -- Added support for f-strings +### [0.1.2] - 2021-10-01 +- Updated package.json display name and keywords -### [1.0.0] - 2019-03-29 -- Added snippet and keybinding -### [0.1.0] - 2019-03-28 +### [0.0.1] - 2021-09-16 - Published on VS Code marketplace -## [0.0.1] - 2018-03-28 -### Added -- First working version +### [0.0.0] - 2021-09-14 + +- Forked from python-string-sql +- This is a refocussing of the extension python-string-sql from sql and html to javascript. \ No newline at end of file diff --git a/README.md b/README.md index 293c432..4c12140 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,6 @@ -# SQL highlighting in Python multiline strings for VS Code +# Javascript highlighting in Python multiline strings for VS Code -Adds syntax highlight support for python multiline SQL strings in VS Code. - -## Installation - -Install `python-string-sql` from extensions (`ctrl + shift + x` or `cmd + shift + x` on mac). -> Also available on [marketplace.visualstudio.com](https://marketplace.visualstudio.com/items?itemName=ptweir.python-string-sql) +Adds syntax highlight support for python multiline Javascript strings in VS Code. ## Example @@ -13,46 +8,29 @@ 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 `//js` at the beginning of the part of the string you would like highlighted and `;//` at the end of the highlighted section. ### Snippets -begin typing `sql` and the autocomplete snippet will appear: - -![Snippet](docs/snippet.gif) - -### Keybindings +begin typing `js` or `sql` and the autocomplete snippet will appear -cmd+s (or ctrl+s on mac) - Insert the following snippet: -``` -""" ---sql -SELECT -; -""" -``` ## Requirements - -- Visual Studio Code v1.32.0 recommended - Comments at beginning and end of highlighted section in the string (see Usage section). ## Community -- 2018-09-04 forked from [es6-string-css](https://github.com/bashmish/es6-string-css) +- Forked from python-string-sql ## Release Notes +### [0.1.2] - 2021-10-01 +- Updated package.json display name and keywords -### [1.1.0] - 2019-06-04 -- Added support for f-strings - -### [1.0.0] - 2019-03-29 -- Added snippet and keybinding -### [0.1.0] - 2019-03-28 +### [0.0.1] - 2021-09-16 - Published on VS Code marketplace -### [0.0.1] - 2019-03-28 -- Got it working based on [these instructions](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide) -### [0.0.0] - 2018-09-04 -- Forked from es6-string-html +### [0.0.0] - 2021-09-14 + +- Forked from python-string-sql +- This is a refocussing of the extension python-string-sql from sql and html to javascript. diff --git a/docs/.DS_Store b/docs/.DS_Store new file mode 100644 index 0000000..0369739 Binary files /dev/null and b/docs/.DS_Store differ diff --git a/docs/demo.png b/docs/demo.png index 8b7036d..35314d3 100644 Binary files a/docs/demo.png and b/docs/demo.png differ diff --git a/docs/demo.py b/docs/demo.py index 2d38ec1..8c4866e 100644 --- a/docs/demo.py +++ b/docs/demo.py @@ -1,19 +1,17 @@ -import psycopg2 - -conn = psycopg2.connect("dbname=test user=postgres") -cur = conn.cursor() - -query = """ ---begin-sql -SELECT last_name, - start_day, - COUNT(*) AS num_entries -FROM schema.table -- great name! -WHERE start_day >= '2019-01-01' -GROUP BY last_name, start_day -ORDER BY num_entries DESC -LIMIT 10; -""" - -cur.execute(query) -first_row = cur.fetchone() +# printschedule +app.clientside_callback( + """ + //js + function(downloaded_btn) { + + if (downloaded_btn !== undefined) { + if (downloaded_btn > 0) { + window.print(); + } + } + } + ;// + """, + Output("window_print_output_placeholder", "data"), + Input('download-btn', 'n_clicks') +) diff --git a/docs/logo.png b/docs/logo.png index 2744264..8900f1b 100644 Binary files a/docs/logo.png and b/docs/logo.png differ diff --git a/docs/python-string-sql-1.1.0.vsix b/docs/python-string-sql-1.1.0.vsix deleted file mode 100644 index 14a230d..0000000 Binary files a/docs/python-string-sql-1.1.0.vsix and /dev/null differ diff --git a/docs/python-string-syntax-highlight-0.1.2.vsix b/docs/python-string-syntax-highlight-0.1.2.vsix new file mode 100644 index 0000000..1f5cad5 Binary files /dev/null and b/docs/python-string-syntax-highlight-0.1.2.vsix differ diff --git a/docs/snippet.gif b/docs/snippet.gif deleted file mode 100644 index 502ddda..0000000 Binary files a/docs/snippet.gif and /dev/null differ diff --git a/package-lock.json b/package-lock.json index 6b0cfca..3ef8e85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "python-string-sql", - "version": "1.1.0", + "name": "python-string-syntax-highlight", + "version": "0.1.0", "lockfileVersion": 1 } diff --git a/package.json b/package.json index 098c6c1..8d44028 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,27 @@ { - "name": "python-string-sql", - "displayName": "python-string-sql", - "description": "highlight python strings as sql", - "version": "1.1.0", - "publisher": "ptweir", + "name": "python-string-syntax-highlight", + "displayName": "Highlight Javascript in Python Strings", + "description": "Highlight python strings as javascript, SQL, or HTML - Dash clientside callbacks", + "version": "0.1.2", + "publisher": "stevenallenking", "icon": "docs/logo.png", "repository": { - "url": "https://github.com/ptweir/python-string-sql" + "url": "https://github.com/StevenAllenKing/python-string-syntax-highlight" }, "engines": { "vscode": "^1.32.0" }, "categories": [ "Programming Languages", - "Snippets" + "Snippets", + "Formatters" + ], + "keywords": [ + "syntax highlight", + "javascript", + "python", + "dash", + "syntax highlighting" ], "contributes": { "grammars": [ @@ -36,6 +44,19 @@ "embeddedLanguages": { "meta.embedded.block.html": "html" } + }, + { + "path": "./syntaxes/highlight-js-string.json", + "scopeName": "python-js.injection", + "injectTo": [ + "source.python" + ], + "embeddedLanguages": { + "meta.embedded.block.js": "javascript" + }, + "tokenTypes": { + "meta.embedded.block.js": "other" + } } ], "snippets": [ @@ -52,7 +73,7 @@ "when": "editorTextFocus", "args": { "langId": "python", - "name": "SQL_highlighted_string" + "name": "python_highlighted_string" } } ] diff --git a/snippets/.DS_Store b/snippets/.DS_Store new file mode 100644 index 0000000..ad4c8e5 Binary files /dev/null and b/snippets/.DS_Store differ diff --git a/snippets/python.json b/snippets/python.json index 8d3f04f..f20bc80 100644 --- a/snippets/python.json +++ b/snippets/python.json @@ -9,5 +9,15 @@ "\"\"\"" ], "description": "SQL highlighted string" + }, + "js_highlighted_string": { + "prefix": "js", + "body": [ + "\"\"\"", + "//js", + ";//", + "\"\"\"" + ], + "description": "javascript highlighted string" } } \ No newline at end of file diff --git a/syntaxes/.DS_Store b/syntaxes/.DS_Store new file mode 100644 index 0000000..35342cf Binary files /dev/null and b/syntaxes/.DS_Store differ diff --git a/syntaxes/highlight-js-string.json b/syntaxes/highlight-js-string.json new file mode 100644 index 0000000..59a35cc --- /dev/null +++ b/syntaxes/highlight-js-string.json @@ -0,0 +1,24 @@ +{ + "fileTypes": [ + "py" + ], + "injectionSelector": "L:string.quoted.multi.python, L:meta.fstring.python - (comment.line.number-sign.python, punctuation.definition.comment.python)", + "patterns": [ + { + "begin": "//js", + "end": "(;//!js|;//)", + "captures": { + "1": { + "name": "variable.parameter" + } + }, + "patterns": [ + { + "include": "source.js" + } + ] + } + ], + "scopeName": "python-js.injection" + } + \ No newline at end of file