Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

able to customize template tag aside from 'html' (TemplateResult) #64

Open
aelbore opened this issue Feb 10, 2019 · 4 comments
Open

able to customize template tag aside from 'html' (TemplateResult) #64

aelbore opened this issue Feb 10, 2019 · 4 comments

Comments

@aelbore
Copy link

aelbore commented Feb 10, 2019

i create my own template result like

const template = (strings, ...values) => 
  new TemplateResult(strings, values, 'html', defaultTemplateProcessor)

i want to have syntax coloring.

const myTemplate = template `<h1>Hello World</h1>`
@krle997
Copy link

krle997 commented Feb 10, 2019

This is problem for me too. My function name is also called template, but when I use

template<div class=""></div>

I only get intellisense, the whole string is colored green. Could you make the settings.json when we edit and add a new tag that it loads both html colors AND intellisense... Thanks!

@rzahniser
Copy link

As a temporary workaround, you can edit the extension files directly. Go to .vscode/extensions/bierner.lit-html-1.11.0/syntaxes/lit-html.json, and change this line:

"begin": "(?x)(\\b(?:\\w+\\.)*(?:html|raw)\\s*)(`)",

...to contain "template" or whatever other tag(s) you want to use. You'll need to restart VSCode to see the change.

@martypdx
Copy link

This config features appears to be broken. Adding the following to settings does not work:

 "lit-html.tags": [
        "html",
        "raw",
        "banana"
    ],
const template = banana`<span>no syntax highlighting :(</span>`

I can confirm the monkey-patch work around suggested by @rzahniser works. For those wondering, the path referred to is in your home directory.

@ivanjeremic
Copy link

This config features appears to be broken. Adding the following to settings does not work:

 "lit-html.tags": [
        "html",
        "raw",
        "banana"
    ],
const template = banana`<span>no syntax highlighting :(</span>`

I can confirm the monkey-patch work around suggested by @rzahniser works. For those wondering, the path referred to is in your home directory.

Why is this config still broken? Is the only way of making this work to fork the repo and do what @rzahniser sugguested?

I need syntax highlighting for

component`<div>Hey</div>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants