This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
Feature/ Add decorations to store for layer elements #2509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a decorations object to the
NeovimEditorStore
to track the location where layers have rendered elements, this issue was first raised by theimport-cost
layer which can overlap with thegit-blame
layer so the elements render on top of each other.This PR adds an object to the
editorStore
which tracks the lines of a buffer where a layer has rendered elements e.g.This is then passed to the layer context as well as methods to update the location of decorations and to clear them. This allows each layer to have some awareness of where there might be clashes.
In conjunction with the
layers.priority
setting in #2506 this can be used to conditionally render elements based on a users preference for which should have priority. Updating the decorations is optional so not all layers will have to but those that are likely to cause conflicts can.In the future we could pass the exact location and dimensions of elements so a layer could try to position itself to avoid another clashing element but as this seemed potentially more complicated, I've avoided this for now.
I know you are away atm @bryphe but would appreciate your input once you're back as you might have a different/better approach to how we can avoid layers stepping on each others toes.