Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Feature/reapply syntax highlighting onColorscheme autocmd #2565

Conversation

akinsho
Copy link
Member

@akinsho akinsho commented Sep 10, 2018

This PR fixes the issue where setting your colorscheme e.g. as might happen when you source your vim config causes the syntax highlighting to be removed.
The issue is/was that vim re-applied the vim colorscheme highlights ignoring oni's highlighting and oni having cached a record of the highlighted lines believes that everything is still highlighted.

This adds an action to the highlighter that is triggered on the colorscheme autocommand which causes oni to re apply its textmate based highlighting.

Outstanding

  • Currently we call the highlight command for each line/token that requires highlighting, this means we dispatch 100s of atomicCalls to neovim so that when we currently trigger the colorscheme autocmd there is a block for about half a second where a user cannot interact with Oni. ---> 😢 😞 Resolved this by only passing the visible tokens to the highlight function so only those are added to the highlight case when a page redraws

@akinsho akinsho force-pushed the feature/reapply-syntax-highlighting-oncolorscheme-autocmd branch from 6f8c0eb to 83eccd8 Compare October 7, 2018 10:36
@akinsho akinsho requested a review from CrossR October 7, 2018 18:35
@codecov
Copy link

codecov bot commented Oct 7, 2018

Codecov Report

Merging #2565 into master will decrease coverage by <.01%.
The diff coverage is 59.15%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2565      +/-   ##
=========================================
- Coverage    45.3%   45.3%   -0.01%     
=========================================
  Files         361     361              
  Lines       14571   14589      +18     
  Branches     1912    1916       +4     
=========================================
+ Hits         6601    6609       +8     
- Misses       7746    7753       +7     
- Partials      224     227       +3
Impacted Files Coverage Δ
browser/src/Editor/BufferHighlights.ts 16.66% <ø> (ø) ⬆️
...es/SyntaxHighlighting/SyntaxHighlightingReducer.ts 30.95% <0%> (-4.19%) ⬇️
browser/src/Editor/NeovimEditor/NeovimEditor.tsx 8.62% <0%> (ø) ⬆️
browser/src/Utility.ts 46.32% <0%> (-0.7%) ⬇️
...ices/SyntaxHighlighting/SyntaxHighlightingStore.ts 25.86% <0%> (-0.46%) ⬇️
browser/src/neovim/NeovimInstance.ts 5.47% <0%> (ø) ⬆️
...ser/src/Services/SyntaxHighlighting/TokenScorer.ts 97.22% <100%> (ø) ⬆️
...Services/SyntaxHighlighting/TokenThemeProvider.tsx 90.62% <100%> (ø) ⬆️
.../Services/SyntaxHighlighting/SyntaxHighlighting.ts 22.91% <25%> (-1%) ⬇️
browser/src/Services/TokenColors.ts 59.57% <72.72%> (+2.43%) ⬆️
... and 2 more

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 11af1f8...c0c33f7. Read the comment docs.

@akinsho akinsho mentioned this pull request Oct 7, 2018
1 task
@akinsho akinsho merged commit 65d0e20 into onivim:master Oct 19, 2018
@akinsho akinsho deleted the feature/reapply-syntax-highlighting-oncolorscheme-autocmd branch October 19, 2018 09:27
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.

2 participants