Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

akinsho
Copy link
Member

@akinsho akinsho commented Aug 19, 2018

Adds a decorations object to the NeovimEditorStore to track the location where layers have rendered elements, this issue was first raised by the import-cost layer which can overlap with the git-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.

	const decorations = {
		line1: ["vcs.blame", "import-cost"],
		line17: ["vcs.blame"],
	}

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.

@akinsho akinsho changed the title Add a decorations key in the Store to track to location where layers have rendered elements Feature/ Add decorations to store for layer elements Aug 19, 2018
@codecov
Copy link

codecov bot commented Aug 20, 2018

Codecov Report

Merging #2509 into master will increase coverage by 0.07%.
The diff coverage is 52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2509      +/-   ##
==========================================
+ Coverage   44.18%   44.26%   +0.07%     
==========================================
  Files         344      345       +1     
  Lines       13888    13963      +75     
  Branches     1829     1832       +3     
==========================================
+ Hits         6137     6181      +44     
- Misses       7511     7542      +31     
  Partials      240      240
Impacted Files Coverage Δ
...owser/src/Editor/NeovimEditor/NeovimEditorStore.ts 61.53% <ø> (ø) ⬆️
...src/Editor/NeovimEditor/NeovimBufferLayersView.tsx 81.08% <100%> (+1.08%) ⬆️
...ser/src/Editor/NeovimEditor/NeovimEditorReducer.ts 16.27% <13.63%> (-0.55%) ⬇️
...ser/src/Editor/NeovimEditor/NeovimEditorActions.ts 68.57% <66.66%> (+7.37%) ⬆️
...rvices/VersionControl/VersionControlBlameLayer.tsx 75.71% <78.94%> (-0.93%) ⬇️
browser/src/UI/components/Error.tsx 41.3% <0%> (-0.92%) ⬇️
browser/src/UI/components/BufferScrollBar.tsx 62.5% <0%> (ø)
...er/src/Editor/NeovimEditor/NeovimEditorCommands.ts 12.28% <0%> (+0.95%) ⬆️
browser/src/Editor/NeovimEditor/Definition.ts 31.57% <0%> (+9.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 795636c...ee64fa7. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant