The decorate function allows you to add or replace text decorations (like import costs or status messages) at specific lines in a file. It takes a filename, an array of properties containing the text and line number, and a color string. The decorations are rendered as text appearing after the line content.
Parameters:
fileName: The path/name of the file to decorate.props: An array of objects { text: string; line: number; } specifying what to display and on which line.color: The CSS color string for the decoration text.
Note: The function automatically calls refreshDecorations after updating the internal state.
import { decorate } from './decorator';
decorate(
'example.html',
[
{ text: ' (1.2kb)', line: 10 },
{ text: ' (5.0kb)', line: 15 }
],
'#ff0000'
);