microsoft / typescript-lit-html-plugin

TypeScript server plugin that adds intellisense for lit-html template strings
MIT License
253 stars 20 forks source link

Could something like this work with vanilla JS? #4

Open rchrdnsh opened 6 years ago

rchrdnsh commented 6 years ago

Could a plugin like this work without lit-html and/or with any JS file that has a template literal in it?

mjbvz commented 6 years ago

Yes. By default the plugin is active in any template tagged with html but you can configure which tags are used: https://github.com/Microsoft/typescript-lit-html-plugin#tags

Can you provide some examples of other possible template strings you'd like this plugin to support?

rchrdnsh commented 6 years ago

I have been starting to learn how to build vanilla web components, and I have also been starting to use template literals in JS arrays and objects to create and store fully dynamic content. Since I am writing my content inside template literals inside a JS object it becomes quite painful when there is no autocompletion or syntax highlighting, which slows me down and leads to typos in my code and content as well. AS far as WC's, there is at least some form of syntax highlighting in Atom, but alas, not autocompletion, so the issues affect me there as well. These are my current use cases, but as I explore template literals more and more I'm sure that more use cases will arise :-)

wanton7 commented 5 years ago

Any change to have this work without tagging a string with html? Maybe using a comment front of the literal string? Something like var foo = /* lit-html */ `literal string`;