Interface IModelDecorationOptions

Expand description

Options for a model decoration.

interface IModelDecorationOptions {
    after?: InjectedTextOptions;
    afterContentClassName?: string;
    before?: InjectedTextOptions;
    beforeContentClassName?: string;
    blockClassName?: string;
    blockDoesNotCollapse?: boolean;
    blockIsAfterEnd?: boolean;
    blockPadding?: [
        top: number,
        right: number,
        bottom: number,
        left: number,
    ];
    className?: string;
    firstLineDecorationClassName?: string;
    fontFamily?: string;
    fontSize?: string;
    fontStyle?: string;
    fontWeight?: string;
    glyphMargin?: IModelDecorationGlyphMarginOptions;
    glyphMarginClassName?: string;
    glyphMarginHoverMessage?: | IMarkdownString
    | IMarkdownString[];
    hoverMessage?: IMarkdownString
    | IMarkdownString[];
    inlineClassName?: string;
    inlineClassNameAffectsLetterSpacing?: boolean;
    isWholeLine?: boolean;
    lineHeight?: number;
    lineNumberClassName?: string;
    lineNumberHoverMessage?:
        | IMarkdownString
        | IMarkdownString[];
    linesDecorationsClassName?: string;
    linesDecorationsTooltip?: string;
    marginClassName?: string;
    minimap?: IModelDecorationMinimapOptions;
    overviewRuler?: IModelDecorationOverviewRulerOptions;
    shouldFillLineOnLineBreak?: boolean;
    showIfCollapsed?: boolean;
    stickiness?: TrackedRangeStickiness;
    textDirection?: TextDirection;
    zIndex?: number;
}

Properties§

§after?: InjectedTextOptions

If set, text will be injected in the view after the range.

§afterContentClassName?: string

If set, the decoration will be rendered after the text with this CSS class name.

§before?: InjectedTextOptions

If set, text will be injected in the view before the range.

§beforeContentClassName?: string

If set, the decoration will be rendered before the text with this CSS class name.

§blockClassName?: string
§blockDoesNotCollapse?: boolean
§blockIsAfterEnd?: boolean

Indicates if this block should be rendered after the last line. In this case, the range must be empty and set to the last line.

§blockPadding?: [top: number, right: number, bottom: number, left: number]
§className?: string

CSS class name describing the decoration.

§firstLineDecorationClassName?: string

If set, the decoration will be rendered in the lines decorations with this CSS class name, but only for the first line in case of line wrapping.

§fontFamily?: string

Font family

§fontSize?: string

Font size

§fontStyle?: string

Font style

§fontWeight?: string

Font weight

§glyphMargin?: IModelDecorationGlyphMarginOptions

If set and the decoration has glyphMarginClassName set, render this decoration with the specified IModelDecorationGlyphMarginOptions in the glyph margin.

§glyphMarginClassName?: string

If set, the decoration will be rendered in the glyph margin with this CSS class name.

§glyphMarginHoverMessage?: IMarkdownString | IMarkdownString[]

Message to be rendered when hovering over the glyph margin decoration.

§hoverMessage?: IMarkdownString | IMarkdownString[]

Array of MarkdownString to render as the decoration message.

§inlineClassName?: string

If set, the decoration will be rendered inline with the text with this CSS class name. Please use this only for CSS rules that must impact the text. For example, use className to have a background color decoration.

§inlineClassNameAffectsLetterSpacing?: boolean

If there is an inlineClassName which affects letter spacing.

§isWholeLine?: boolean

Should the decoration expand to encompass a whole line.

§lineHeight?: number

If set, the decoration will override the line height of the lines it spans. Maximum value is 300px.

§lineNumberClassName?: string

If set, the decoration will be rendered on the line number.

§lineNumberHoverMessage?: IMarkdownString | IMarkdownString[]

Array of MarkdownString to render as the line number message.

§linesDecorationsClassName?: string

If set, the decoration will be rendered in the lines decorations with this CSS class name.

§linesDecorationsTooltip?: string

Controls the tooltip text of the line decoration.

§marginClassName?: string

If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.

§minimap?: IModelDecorationMinimapOptions

If set, render this decoration in the minimap.

§overviewRuler?: IModelDecorationOverviewRulerOptions

If set, render this decoration in the overview ruler.

§shouldFillLineOnLineBreak?: boolean

Indicates whether the decoration should span across the entire line when it continues onto the next line.

§showIfCollapsed?: boolean

Always render the decoration (even when the range it encompasses is collapsed).

§stickiness?: TrackedRangeStickiness

Customize the growing behavior of the decoration when typing at the edges of the decoration. Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges

§textDirection?: TextDirection

The text direction of the decoration.

§zIndex?: number

Specifies the stack order of a decoration. A decoration with greater stack order is always in front of a decoration with a lower stack order when the decorations are on the same line.