Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

::before / ::after decorators not always rendered on empty ranges #37401

Closed
alexdima opened this issue Nov 1, 2017 · 2 comments
Closed

::before / ::after decorators not always rendered on empty ranges #37401

alexdima opened this issue Nov 1, 2017 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@alexdima
Copy link
Member

alexdima commented Nov 1, 2017

From @guillaumejenkins


@alexandrudima is this by design?

  • ::before decorators are not rendered if the range is at the end of the line
  • ::after decorators are not rendered if the range is at the beginning of the line
  • Only ::before shows for empty lines (which might be the same issue as above)

Note that this is all for empty ranges.

I need both ::after and ::before (because I need the content CSS property twice). Currently I can't do that because only one shows up at the start or end of the line.

image

        const editor = vscode.window.activeTextEditor;
        const doc = editor.document;

        // Set up ::before at the start and end of line 0
        const beforeDeco = vscode.window.createTextEditorDecorationType({
            before: {
                contentText: 'b',
                color: 'yellow'
            }
        });
        const line0Range = doc.lineAt(0).range;
        const line0Start = new vscode.Range(line0Range.start, line0Range.start);
        const line0End = new vscode.Range(line0Range.end, line0Range.end);
        editor.setDecorations(beforeDeco, [line0Start, line0End]);

        // Set up ::after at the start and end of line 1
        const afterDeco = vscode.window.createTextEditorDecorationType({
            after: {
                contentText: 'a',
                color: 'red'
            }
        });
        const line1Range = doc.lineAt(1).range;
        const line1Start = new vscode.Range(line1Range.start, line1Range.start);
        const line1End = new vscode.Range(line1Range.end, line1Range.end);
        editor.setDecorations(afterDeco, [line1Start, line1End]);

        // Set up ::before and ::after on line 3 (empty line)
        const beforeAfterDeco = vscode.window.createTextEditorDecorationType({
            before: {
                contentText: 'b',
                color: 'yellow'
            },
            after: {
                contentText: 'a',
                color: 'red'
            }
        });
        const line3Range = doc.lineAt(3).range;
        const line3Start = new vscode.Range(line3Range.start, line3Range.start);
        editor.setDecorations(beforeAfterDeco, [line3Start]);
@alexdima alexdima self-assigned this Nov 1, 2017
@alexdima alexdima added this to the October 2017 milestone Nov 1, 2017
@alexdima
Copy link
Member Author

alexdima commented Nov 1, 2017

This would require changes too risky to push for October. Postponing...

@alexdima
Copy link
Member Author

after:
image

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 21, 2017
@roblourens roblourens added the verified Verification succeeded label Dec 6, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants