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

Text decorations do not currently displace editor rulers, a better API to do so would be useful #164670

Closed
samraul opened this issue Oct 26, 2022 · 4 comments
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality

Comments

@samraul
Copy link

samraul commented Oct 26, 2022

Hi,

A common use of text decorations is to render information per line of code. I am working on an extension that does this (using the before decoration). One issue with the current editor behavior is that the rulers remain at their set columns despite the text decorations, which no longer makes sense for the user, since the decoration has displaced the text to the right.

Although text decorations are per line, it makes sense to displace the rulers when all lines are decorated.

I am able to change the rulers with:

// newRulers = currentRulers + decoration_offset
vscode.workspace.getConfiguration().update("editor.rulers", newRulers);

However, this seems rather brittle:

  • The extension may not have the chance to remove the persistent modification if the app is closed.
  • The extension needs to wait for the thenable returned by update before requesting the new value, which makes multiple extensions modifying this configuration potentially not compatible with each other, since they may try to set the values at the same time.
  • The user or other extension may modify a different scope than what one extension is modifying, with varying consequences.

Ideally the extensions should be able to either:
a. request an specific offset setRulerExtensionOffset('extension_name', offset) // offset=0 to remove
or
b. request that the ruler takes the before and/or after text decorations into account for where to render the ruler

There is a related issue #111251 with a pending PR, but it seems to be aimed at adding rulers, not at modifying existing rulers due to text decorations.

Please, let me know if there is a better approach.

Thanks!

@alexdima alexdima added editor-rendering Editor rendering issues feature-request Request for new features or functionality labels Oct 26, 2022
@alexdima alexdima removed their assignment Oct 26, 2022
@vscodenpa vscodenpa added this to the Backlog Candidates milestone Oct 26, 2022
@vscodenpa
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@samraul
Copy link
Author

samraul commented Oct 26, 2022

@eamodio I think GitLens would benefit from this for the blame annotations for example?

@vscodenpa
Copy link

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa
Copy link

🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2023
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

3 participants