Skip to content

Commit

Permalink
html
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 21, 2023
1 parent a82eca2 commit a182f7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions exts/vscode-tailwind-preview/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,27 @@ function renderHtml(
document.positionAt(tag.opening.start),
document.positionAt(tag.closing.end)
);
return [JSON.stringify(tag), range];
return [document.getText(range), range];
}
return;
}

export function activate(context: vscode.ExtensionContext) {
// Show image on hover
const hoverProvider: vscode.HoverProvider = {
provideHover(document, position) {
async provideHover(document, position) {
const rendeded = renderHtml(document, position);
if (!rendeded) {
return;
}
const [htmlText, range] = rendeded;

const content = new vscode.MarkdownString(
`<img src="${cats["Coding Cat"]}" width=144 height=144/>`
`
<div>
${htmlText}
</div>
`
);

content.supportHtml = true;
Expand Down

0 comments on commit a182f7e

Please sign in to comment.