mjbvz/vscode-comment-tagged-templates

Syntax highlighting for JS and TS tagged template strings using comments to specify language

See the code

README

VS Code extension that adds basic syntax highlighting for JavaScript and TypeScript tagged template strings using language identifier comments:

const cssString = /* css */ `
    button {
        color: hotpink !important;
    }
`;

const htmlString = /* html */`
    <button class="my-button">
        Click me!
    </button>
`;

Usage

The language identifier comment must appear before the opening backtick for the template string. Here is basic list of valid identifiers (note that some languages require that you install an VS Code extension that provides a grammar for that language):

LanguageSupported Identifiers
csscss, css.erb
basichtml, htm, shtml, xhtml, inc, tmpl, tpl
iniini, conf
javajava, bsh
lualua
makefileMakefile, makefile, GNUmakefile, OCamlMakefile
perlperl, pl, pm, pod, t, PL, psgi, vcl
rR, r, s, S, Rprofile
rubyruby, rb, rbx, rjs, Rakefile, rake, cgi, fcgi, gemspec, irbrc, Capfile, ru, prawn, Cheffile, Gemfile, Guardfile, Hobofile, Vagrantfile, Appraisals, Rantfile, Berksfile, Berksfile.lock, Thorfile, Puppetfile
phpphp, php3, php4, php5, phpt, phtml, aw, ctp
sqlsql, ddl, dml
vs_netvb
xmlxml, xsd, tld, jsp, pt, cpt, dtml, rss, opml
xslxsl, xslt
yamlyaml, yml
dosbatchbat, batch
clojureclj, cljs, clojure
coffeecoffee, Cakefile, coffee.erb
cc, h
cppcpp, c++, cxx
diffpatch, diff, rej
dockerfiledockerfile, Dockerfile
git_commitCOMMIT_EDITMSG, MERGE_MSG
git_rebasegit-rebase-todo
gogo, golang
graphqlgql, qgl, graphql
groovygroovy, gvy
pugjade, pug
jsjs, jsx, javascript, es6, mjs
js_regexpregexp
jsonjson, sublime-settings, sublime-menu, sublime-keymap, sublime-mousemap, sublime-theme, sublime-build, sublime-project, sublime-completions
lessless
mdmd, markdown
mjmlmjml
objcobjectivec, objective-c, mm, objc, obj-c, m, h
scssscss
perl6perl6, p6, pl6, pm6, nqp
powershellpowershell, ps1, psm1, psd1
pythonpython, py, py3, rpy, pyw, cpy, SConstruct, Sconstruct, sconstruct, SConscript, gyp, gypi
regexp_pythonre
rustrust, rs
scalascala, sbt
shellshell, sh, bash, zsh, bashrc, bash_profile, bash_login, profile, bash_logout, .textmate_init
tstypescript, ts
tsxtsx
csharpcs, csharp, c#
fsharpfs, fsharp, f#
dartdart
glslglsl
liquidliquid
sparqlsparql
applescriptapplescript
edgeqledgeql
cyphercypher, cyp, cql
prqlprql
latexlatex, tex
svgsvg

Advanced language support

For IntelliSense and more advanced embedded language support, checkout these extensions:

Contributing

To build this extension, you'll need Git and Node.js.

First, fork this repo and clone your fork:

git clone https://github.com/YOUR_GITHUB_ACCOUNT_NAME/vscode-comment-tagged-templates.git
code vscode-comment-tagged-templates

Then install dev dependencies using npm:

npm install

The main grammar is generated using the script in build/build.js. To run it:

npm run build

The generate grammar files will be written to the syntaxes directory. The grammar files are regenerated on each build so you should not make manual changes in them.

The supported languages are defined in build/languages.js

To run the tests:

npm run test

Contributors

mjbvz

18 commits

Copilot

4 commits

janispritzkau

2 commits

mjbvz/vscode-comment-tagged-templates

Syntax highlighting for JS and TS tagged template strings using comments to specify language

See the code

README

VS Code extension that adds basic syntax highlighting for JavaScript and TypeScript tagged template strings using language identifier comments:

const cssString = /* css */ `
    button {
        color: hotpink !important;
    }
`;

const htmlString = /* html */`
    <button class="my-button">
        Click me!
    </button>
`;

Usage

The language identifier comment must appear before the opening backtick for the template string. Here is basic list of valid identifiers (note that some languages require that you install an VS Code extension that provides a grammar for that language):

LanguageSupported Identifiers
csscss, css.erb
basichtml, htm, shtml, xhtml, inc, tmpl, tpl
iniini, conf
javajava, bsh
lualua
makefileMakefile, makefile, GNUmakefile, OCamlMakefile
perlperl, pl, pm, pod, t, PL, psgi, vcl
rR, r, s, S, Rprofile
rubyruby, rb, rbx, rjs, Rakefile, rake, cgi, fcgi, gemspec, irbrc, Capfile, ru, prawn, Cheffile, Gemfile, Guardfile, Hobofile, Vagrantfile, Appraisals, Rantfile, Berksfile, Berksfile.lock, Thorfile, Puppetfile
phpphp, php3, php4, php5, phpt, phtml, aw, ctp
sqlsql, ddl, dml
vs_netvb
xmlxml, xsd, tld, jsp, pt, cpt, dtml, rss, opml
xslxsl, xslt
yamlyaml, yml
dosbatchbat, batch
clojureclj, cljs, clojure
coffeecoffee, Cakefile, coffee.erb
cc, h
cppcpp, c++, cxx
diffpatch, diff, rej
dockerfiledockerfile, Dockerfile
git_commitCOMMIT_EDITMSG, MERGE_MSG
git_rebasegit-rebase-todo
gogo, golang
graphqlgql, qgl, graphql
groovygroovy, gvy
pugjade, pug
jsjs, jsx, javascript, es6, mjs
js_regexpregexp
jsonjson, sublime-settings, sublime-menu, sublime-keymap, sublime-mousemap, sublime-theme, sublime-build, sublime-project, sublime-completions
lessless
mdmd, markdown
mjmlmjml
objcobjectivec, objective-c, mm, objc, obj-c, m, h
scssscss
perl6perl6, p6, pl6, pm6, nqp
powershellpowershell, ps1, psm1, psd1
pythonpython, py, py3, rpy, pyw, cpy, SConstruct, Sconstruct, sconstruct, SConscript, gyp, gypi
regexp_pythonre
rustrust, rs
scalascala, sbt
shellshell, sh, bash, zsh, bashrc, bash_profile, bash_login, profile, bash_logout, .textmate_init
tstypescript, ts
tsxtsx
csharpcs, csharp, c#
fsharpfs, fsharp, f#
dartdart
glslglsl
liquidliquid
sparqlsparql
applescriptapplescript
edgeqledgeql
cyphercypher, cyp, cql
prqlprql
latexlatex, tex
svgsvg

Advanced language support

For IntelliSense and more advanced embedded language support, checkout these extensions:

Contributing

To build this extension, you'll need Git and Node.js.

First, fork this repo and clone your fork:

git clone https://github.com/YOUR_GITHUB_ACCOUNT_NAME/vscode-comment-tagged-templates.git
code vscode-comment-tagged-templates

Then install dev dependencies using npm:

npm install

The main grammar is generated using the script in build/build.js. To run it:

npm run build

The generate grammar files will be written to the syntaxes directory. The grammar files are regenerated on each build so you should not make manual changes in them.

The supported languages are defined in build/languages.js

To run the tests:

npm run test

Contributors

mjbvz

18 commits

Copilot

4 commits

janispritzkau

2 commits

Languages

TypeScript

74.1%

JavaScript

25.6%