Closed ExE-Boss closed 4 months ago
I can't even publish latest changes to vsce, but I also know nothing about vs code in general, so anything that is not in yet, or easy to change, won't likely land, 'cause I wouldn't know how.
OK, I've eventually managed to push the node
part, that's something ... now, about prettier, I still wouldn't know what to do here, so I'll flag as help wanted, sure enough pretty much nobody will show up 😅 (but at least I've tried)
All you need to do is highlight template strings that follow a /* HTML */
comment as being HTML.
const example = /* HTML */ `
<div>${getHTML()}</div>
`;
does prettier put that also in between html
or svg
and the template literal content?
does prettier put that also in between
html
orsvg
and the template literal content?
No, it only needs it for the likes of unknownHtmlTag
(currently html.node
, html.for(…)
, etc.).
Without /* HTML */
Prettier ends up formatting the unknownHtmlTag
template tag as a normal template string.
this looks like a Prettier bug then, as it should allow custom definition of what's is known to produce from html template literals (which should be literally any tag function or anything used as tag).
I don't think I ever want /* HTML */
comments on my way, so I am not sure I should do anything in here.
@WebReflection How can someone get syntax highlighting in an untagged template literal with your extension then ? If /* HTML */
before the literal is not ok , is having the literal inside of it to start with <--!html-->
ok ?
I don't known, PR welcome
Added a WARNING in the README with suggested alternatives: https://github.com/WebReflection/vscode-literally-html/tree/master?tab=readme-ov-file#warning
Prettier uses the
/* HTML */
comment prefix as a hint that a template string contains HTML markup when it can’t otherwise determine what the template string contains./cc @prettier/core @evilebottnawi @jf-1 @lydell