-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): consider entire config when hashing (#350)
- Hash entire config instead of just the table passed to `setup()`. This helps to ensure that a recompilation occurs when overrides are set outside of `setup()`. - Loading/sourcing colorscheme now causes recompilation if config or overrides have changed, even if `setup()` has been called before. - Clear `vim.g.colors_name` before setting `vim.o.background` so that colorscheme is not reloaded recursively when setting `vim.o.background` (as opposed to using a variable to check for nested colorscheme load, which is what we were doing before). - fix(compiler): always write hash to filesystem when a compilation occurs, incl. when `require('github-theme').compile()` is called directly. Related: #262, #340, #341
- Loading branch information
Showing
8 changed files
with
104 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
local M = {} | ||
local M = { unique_hlgroup = '____0' } | ||
local api = vim.api | ||
|
||
function M.await_VimEnter() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local assert = require('luassert') | ||
local t_util = require('github-theme._test.util') | ||
local uniqgrp = t_util.unique_hlgroup | ||
|
||
if vim.fn.has('nvim-0.9.0') == 0 or vim.fn.has('nvim-0.9.0') == false then | ||
return | ||
end | ||
|
||
describe('compiler', function() | ||
before_each(function() | ||
require('github-theme.util.reload')(true) | ||
end) | ||
|
||
it('should consider previously-set overrides (1)', function() | ||
local same_opts = {} | ||
require('github-theme').setup(same_opts) | ||
require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } } | ||
require('github-theme').setup(same_opts) | ||
vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } }) | ||
assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true)) | ||
end) | ||
|
||
it('should consider previously-set overrides (2)', function() | ||
require('github-theme').setup({}) | ||
require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } } | ||
vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } }) | ||
assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true)) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters