monaco-react icon indicating copy to clipboard operation
monaco-react copied to clipboard

Overlapping lines decorations

Open Etsija opened this issue 2 years ago • 1 comments

We are using your component extensively for marking license hits in the editor gutter with decorations. Each detected license gets its own colour, and we are passing this colour in linesDecorationsClassName. The result is this: Original

Currently, the lines are shown with

const className = compound
    ? "bg-gray-400"
    : `bg-${expression} w-3 ml-3`;
    ...
const decoration = {
    range: range,
    options: {
        isWholeLine: true,
        linesDecorationsClassName: `${className}`,
    },
};

As some of these "license hits" overlap each other, we'd need a way to show "overlapping but offset" lines in the editor gutter, as described in this picture: Overlapping

The problem is, lines decorations in the gutter always seem to stick to the rightmost end of the gutter, and setting the right margin for shifting some lines to the left does nothing. So, for example, this doesn't work at all:

const className = compound
    ? "bg-gray-400"
    : `bg-${expression} w-3 mr-3`;

Is this a limitation of the Monaco Editor component itself, and any ideas to circumvent it or implement some support for shifting the decorations horizontally in the editor gutter?

Etsija avatar Mar 13 '24 07:03 Etsija

This issue should be referred to microsoft/monaco-editor

suren-atoyan avatar Mar 13 '24 12:03 suren-atoyan

This issue has been marked as stale due to inactivity. It will be closed in 7 days unless further activity occurs.

github-actions[bot] avatar Feb 28 '25 00:02 github-actions[bot]

Closing due to inactivity. Feel free to reopen if needed.

github-actions[bot] avatar Mar 07 '25 00:03 github-actions[bot]