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

html formatting is not working #71

Open
mvsubhash29 opened this issue May 8, 2019 · 8 comments
Open

html formatting is not working #71

mvsubhash29 opened this issue May 8, 2019 · 8 comments

Comments

@mvsubhash29
Copy link

html formatting is not working even if i enable formatting in the setting. Is there any bug are issue in formatting.

Is it same for everyone? Kindly help me in this.

Thanks
Subhash

@mjbvz
Copy link
Owner

mjbvz commented May 8, 2019

Please share details, such as example code (as text)

@vegarringdal
Copy link

here is a sample

this will give me
image

it happends when function params is over 1 row

import {
    LitElement, html, customElement, property
} from 'lit-element';


const myhtml = (something: {
    text: string;
    optional?: number
}) => {
    return html`<div>${something.text}</div>`
}


@customElement('app-component')
export class AppComponent extends LitElement {

    render() {
        return html`
                    <div>
                        ${myhtml(
                            { text: 'cool' })}
                                </div>
        `
    }
}

@vegarringdal
Copy link

hmm

Something like this:

 render() {
        return html`
                    <div>
                        ${myhtml(   "text")}
                        </div>
        `
    }

wil also make it fail, but not sure if this really have anything to do with this plugin really

@vegarringdal
Copy link

Adding prettier as default formater helped this issue.
But nice if vscode could do this by default.

@gnehcwu
Copy link

gnehcwu commented Oct 17, 2019

Adding prettier as default formater helped this issue.
But nice if vscode could do this by default.

Noticed this as well, the default "vscode.typescript-language-features" doesn't work, not sure if there will be any fix to it in the future?

@andrius-pra
Copy link

andrius-pra commented Jan 23, 2020

html formatting, folding only works when typescript.tsserver.useSeparateSyntaxServer setting is false

@lifeart
Copy link

lifeart commented Oct 13, 2021

It's not working for custom lit-html.tags tags configuration, I use hbs instead of html and it's stopped working, but once I replace hbs with html it's working back

@kvnloughead
Copy link

For me, no formatting was occurring until I had added these four settings.

"lit-html.tags": ["html"],
"lit-html.format.enabled": true,
"typescript.tsserver.useSyntaxServer": "never",
"editor.defaultFormatter": "esbenp.prettier-vscode"

I don't know which might have solved the problem... especially considering that now I've removed them all and the formatting still works! With one caveat -- the formatting still didn't work for the strings I had already created. I had to make new one's to see that it was working.

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

7 participants