ReviewOS

stacks/stx

vscode: utility-class hovers never show formatted CSS (prettifyCSS calls .trim() on a promise)

#2024
Closed chris opened this 9 days ago ·
9 days ago

prettifyCSS (packages/vscode/src/ts-css/utils/css-parser.ts) called .trim() directly on the result of prettier.format. Prettier 3's format returns a promise, so that threw a TypeError, the catch returned the input unchanged, and every utility-class hover showed the CSS engine's raw output.

Visible on any class whose output the engine does not already indent: long declarations stay on one line (transition, shadow-lg, ring-2, backdrop-blur), keyframes stay one step per line (animate-spin), and selectors keep the engine's spacing ([&>*]:p-2).

Affects the stx extension (Stacks.vscode-stx) and every extension embedding @stacksjs/stx-vscode, including Stacks.vscode-stacks.

Fix: make prettifyCSS async, await it in the hover provider, and test the hover output through the real engine and Prettier.

Sign in to comment on this issue.