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

Inline decorations can conflict with one another #33852

Closed
eamodio opened this issue Sep 5, 2017 · 5 comments
Closed

Inline decorations can conflict with one another #33852

eamodio opened this issue Sep 5, 2017 · 5 comments
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Sep 5, 2017

  • VSCode Version: Code - Insiders 1.16.0-insider (1452d0a, 2017-09-04T20:15:38.808Z)
  • OS Version: Windows_NT x64 10.0.16281

I have both GitLens and Import Cost extensions installed and the decorators added to the end of the line by both seem to conflict as can be seen below.

decorators

I would have either expected the GitLens decoration to no appear at all (less than ideal imo) or that the GitLens decoration (since it was being added last) would win (and once it was removed it would revert to the previous one). But currently it looks like some properties between the 2 decorators get merged which looks far less than ideal 😄

Originally reported here: gitkraken/vscode-gitlens#131

Reproduces without extensions: No

@vscodebot vscodebot bot added the insiders label Sep 5, 2017
@rebornix rebornix added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Sep 5, 2017
@rebornix rebornix removed their assignment Sep 5, 2017
@rebornix rebornix added the editor label Sep 5, 2017
@rebornix
Copy link
Member

rebornix commented Sep 5, 2017

@eamodio we applied CSS for decorations to the elements so if there are two decorators on the same character, we don't decide which one should be shown, which one should not.

But for this particular case, there is a workaround to make it look better

image

Both the first rule and third rule are from GitLens while Import Cost put them in the same rule. I suppose GitLens tries to add a new decoration for current selected line, that's why it has the top priority. A workaround is merging them

.currentline {
  color: rgba()
  content: ""
}

.others {
  content: ""
}

@eamodio
Copy link
Contributor Author

eamodio commented Sep 5, 2017

I debugged this a bit from the GitLens side and I see that I am setting a few decorations (1 for the trailing content, 1 for the commit details hover, 1 for the commit changes hover). It seems like the trailing content decoration is the issue here. This is what I am setting:

{
    range,
    renderOptions: {
        after: {
            contentText: "context goes here"
        },
        dark: {
            after: {
                backgroundColor: undefined,
                color: "rgba(153, 153, 153, 0.35)"
            }
        }.
        light: {
            after: {
                backgroundColor: undefined,
                color: "rgba(153, 153, 153, 0.35)"
            }
        }
    }
}

So I think the splitting of the css is because of the use of theme blocks.

@roblourens
Copy link
Member

@rebornix I'm not sure what the resolution is or where this needs to go. Can I assign back to you?

@chrmarti chrmarti removed the insiders label Sep 27, 2017
@alexdima alexdima self-assigned this Sep 28, 2017
@rebornix rebornix added the under-discussion Issue is under discussion for relevance, priority, approach label Nov 20, 2017
@rebornix
Copy link
Member

Mark it under-discussion first. Decorations provided by extensions don't have priorities and we merge them and let browser do the merging/overriding/etc.

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug editor-rendering Editor rendering issues and removed *question Issue represents a question, should be posted to StackOverflow (VS Code) editor under-discussion Issue is under discussion for relevance, priority, approach labels Apr 18, 2018
@alexdima alexdima added this to the Backlog milestone Apr 18, 2018
@alexdima alexdima added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Apr 25, 2018
@alexdima alexdima removed their assignment Apr 27, 2018
bmalehorn added a commit to bmalehorn/vscode-error-lens that referenced this issue Oct 9, 2019
VSCode has a long-standing bug
microsoft/vscode#33852: multiple decorators on
the same line are resolved by whichever was inserted *last*. So you set
the **color** in the decoration **type** and the **contentText** in the
decoration **options**, another extension might insert its own style in
between.

This PR implements the suggested workaround: set the `contentText` and
`color` at the same time so they'll always appear together. It does so
setting everything in the decoration **options**, instead of only a
sparse `contentText`.

Related: usernamehw#25
@alexdima alexdima self-assigned this Oct 25, 2019
@alexdima alexdima changed the title Decorators can conflict with one another Inline decorations can conflict with one another Jan 23, 2020
tonycheang added a commit to kiteco/vscode-plugin that referenced this issue Dec 17, 2020
Long standing vscode bug "Inline decorations can interfere with one another"
microsoft/vscode#33852
tonycheang added a commit to kiteco/vscode-plugin that referenced this issue Jan 13, 2021
* update: typescript to latest

* add: ts bundling with ts-loader

* add: KiteCodeLensProvider skeleton

* change: wip codelens -> prototype inline decoration

* update: rm vscode devDep in favor of @types/vscode and vscode-test

See https://code.visualstudio.com/updates/v1_36#_splitting-vscode-package-into-typesvscode-and-vscodetest

* improve: consolidate after block to avoid conflicting styles

Long standing vscode bug "Inline decorations can interfere with one another"
microsoft/vscode#33852

* remove: post-install since now using @types/vscode

* update: webpack and webpack-cli to latest

* migrate: to using vscode-test via webpack transpiling

* improve: fix various tests and improve dev test experience

* improve: use link theme color for inline message

* improve: bump kite-api and use getLineDecoration

* add: source-map and typescript test support

* migrate: expect.js -> chai for assertion style testing

* remove: unused deps + update sinon

* test: codenav-decoration
@alexdima
Copy link
Member

It looks like now the two end-of-line decorations now get appended one after the other, which I consider more reasonable than the previous merging:

image

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants