chore: fix diagnostic warnings/errors

This commit is contained in:
Michael Chris Lopez
2021-10-28 18:24:46 +08:00
parent 8443403a3c
commit fb181a3a36
9 changed files with 24 additions and 14 deletions

View File

@@ -8,7 +8,7 @@ local function write_template(path, template, values)
file:close() file:close()
end end
function build(name, specs, palette, options) local function build(name, specs, palette, options)
local exclude = options.exclude or {} local exclude = options.exclude or {}
local templates = { "vim", "iterm", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" } local templates = { "vim", "iterm", "kitty", "alacritty", "wezterm", "lualine", "lightline", "tmux" }
for _, t in ipairs(templates) do for _, t in ipairs(templates) do
@@ -218,7 +218,7 @@ local colorschemes = {
}, },
} }
function build_from(colorscheme) local function build_from(colorscheme)
if colorscheme.setup then if colorscheme.setup then
colorscheme.setup() colorscheme.setup()
end end

View File

@@ -16,10 +16,11 @@ local function generate(p, opt)
elseif opt.darkness == "warm" then elseif opt.darkness == "warm" then
p1.bg = p.bg_warm p1.bg = p.bg_warm
elseif opt.darkness ~= nil then elseif opt.darkness ~= nil then
local error_msg = "Unknown darkness value: " .. vim.inspect(darkness) local error_msg = "Unknown darkness value: " .. vim.inspect(opt.darkness)
vim.notify(error_msg, vim.log.levels.WARN, { title = "zenbones" }) vim.notify(error_msg, vim.log.levels.WARN, { title = "zenbones" })
end end
---@diagnostic disable: undefined-global
-- stylua: ignore start -- stylua: ignore start
local base = lush(function() local base = lush(function()
return { return {
@@ -255,7 +256,7 @@ local function generate(p, opt)
diffIndexLine { fg = p.wood }, diffIndexLine { fg = p.wood },
gitcommitOverflow { WarningMsg }, gitcommitOverflow { WarningMsg },
markdownH1 { Statement, gui = "bold,underline" }, markdownH1 { Statement, gui = "bold,underline" },
markdownH2 { Statement }, markdownH2 { Statement },
markdownH3 { Statement }, markdownH3 { Statement },
@@ -369,6 +370,7 @@ local function generate(p, opt)
} }
end) end)
-- stylua: ignore end -- stylua: ignore end
---@diagnostic enable: undefined-global
local specs = { local specs = {
base, base,
@@ -377,11 +379,13 @@ local function generate(p, opt)
if opt.lighten_noncurrent_window then if opt.lighten_noncurrent_window then
table.insert( table.insert(
specs, specs,
---@diagnostic disable: undefined-global
lush(function() lush(function()
return { return {
NormalNC { base.Normal, bg = base.Normal.bg.li(2) }, -- normal text in non-current windows NormalNC { base.Normal, bg = base.Normal.bg.li(2) }, -- normal text in non-current windows
} }
end) end)
---@diagnostic enable: undefined-global
) )
end end
@@ -389,6 +393,7 @@ local function generate(p, opt)
if not vim.diagnostic then if not vim.diagnostic then
table.insert( table.insert(
specs, specs,
---@diagnostic disable: undefined-global
lush(function() lush(function()
return { return {
LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
@@ -417,6 +422,7 @@ local function generate(p, opt)
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column -- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
} }
end) end)
---@diagnostic enable: undefined-global
) )
end end
-- stylua: ignore end -- stylua: ignore end

View File

@@ -1,6 +1,6 @@
local M = {} local M = {}
function concat_config(prefix, suffixes) local function concat_config(prefix, suffixes)
local config = {} local config = {}
for i, suffix in ipairs(suffixes) do for i, suffix in ipairs(suffixes) do
config[suffix] = vim.g[prefix .. "_" .. suffix] config[suffix] = vim.g[prefix .. "_" .. suffix]

View File

@@ -16,10 +16,11 @@ local function generate(p, opt)
elseif opt.lightness == "dim" then elseif opt.lightness == "dim" then
p1.bg = p.bg_dim p1.bg = p.bg_dim
elseif opt.lightness ~= nil then elseif opt.lightness ~= nil then
local error_msg = "Unknown lightness value: " .. vim.inspect(lightness) local error_msg = "Unknown lightness value: " .. vim.inspect(opt.lightness)
vim.notify(error_msg, vim.log.levels.WARN, { title = "zenbones" }) vim.notify(error_msg, vim.log.levels.WARN, { title = "zenbones" })
end end
---@diagnostic disable: undefined-global
-- stylua: ignore start -- stylua: ignore start
local base = lush(function() local base = lush(function()
return { return {
@@ -255,7 +256,7 @@ local function generate(p, opt)
diffIndexLine { fg = p.wood }, diffIndexLine { fg = p.wood },
gitcommitOverflow { WarningMsg }, gitcommitOverflow { WarningMsg },
markdownH1 { Statement, gui = "bold,underline" }, markdownH1 { Statement, gui = "bold,underline" },
markdownH2 { Statement }, markdownH2 { Statement },
markdownH3 { Statement }, markdownH3 { Statement },
@@ -369,6 +370,7 @@ local function generate(p, opt)
} }
end) end)
-- stylua: ignore end -- stylua: ignore end
---@diagnostic enable: undefined-global
local specs = { local specs = {
base, base,
@@ -377,11 +379,13 @@ local function generate(p, opt)
if opt.darken_noncurrent_window then if opt.darken_noncurrent_window then
table.insert( table.insert(
specs, specs,
---@diagnostic disable: undefined-global
lush(function() lush(function()
return { return {
NormalNC { base.Normal, bg = base.Normal.bg.da(2) }, -- normal text in non-current windows NormalNC { base.Normal, bg = base.Normal.bg.da(2) }, -- normal text in non-current windows
} }
end) end)
---@diagnostic enable: undefined-global
) )
end end
@@ -389,6 +393,7 @@ local function generate(p, opt)
if not vim.diagnostic then if not vim.diagnostic then
table.insert( table.insert(
specs, specs,
---@diagnostic disable: undefined-global
lush(function() lush(function()
return { return {
LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline) LspDiagnosticsDefaultError { base.DiagnosticError }, -- Used as the base highlight group. Other LspDiagnostic highlights link to this by default (except Underline)
@@ -417,6 +422,7 @@ local function generate(p, opt)
-- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column -- LspDiagnosticsSignHint { }, -- Used for "Hint" signs in sign column
} }
end) end)
---@diagnostic enable: undefined-global
) )
end end
-- stylua: ignore end -- stylua: ignore end

View File

@@ -85,5 +85,5 @@ return function(name, specs, p)
template = template .. table.concat(vim.fn.sort(xml_compiled), "\n") template = template .. table.concat(vim.fn.sort(xml_compiled), "\n")
template = template .. end_template template = template .. end_template
return { string.format("extras/iterm/%s.itermcolors", name), template, values } return { string.format("extras/iterm/%s.itermcolors", name), template, {} }
end end

View File

@@ -23,7 +23,7 @@ let s:p.tabline.tabsel = [ [ "${tabsel_fg}", "${tabsel_bg}", "bold" ] ]
let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p) let g:lightline#colorscheme#zenbones#palette = lightline#colorscheme#fill(s:p)
]] ]]
return function(name, specs, p) return function(name, specs)
return { return {
string.format("autoload/lightline/colorscheme/%s.vim", name), string.format("autoload/lightline/colorscheme/%s.vim", name),
template, template,

View File

@@ -34,7 +34,7 @@ return {
} }
]] ]]
return function(name, specs, p) return function(name, specs)
return { return {
string.format("lua/lualine/themes/%s.lua", name), string.format("lua/lualine/themes/%s.lua", name),
template, template,

View File

@@ -15,10 +15,9 @@ brights = ["${color8}", "${color9}", "${color10}", "${color11}", "${color12}", "
return function(name, specs, p) return function(name, specs, p)
local term = require("zenbones.term").colors_map(p) local term = require("zenbones.term").colors_map(p)
local name = name:sub(1, 1):upper() .. name:sub(2)
local values = { local values = {
name = name, name = name:sub(1, 1):upper() .. name:sub(2),
fg = specs.Normal.fg.hex, fg = specs.Normal.fg.hex,
bg = specs.Normal.bg.hex, bg = specs.Normal.bg.hex,
cursor_bg = specs.Cursor.bg.hex, cursor_bg = specs.Cursor.bg.hex,
@@ -31,5 +30,5 @@ return function(name, specs, p)
values["color" .. (i - 1)] = v.hex values["color" .. (i - 1)] = v.hex
end end
return { string.format("extras/wezterm/%s.toml", name), template, values } return { string.format("extras/wezterm/%s.toml", values.name), template, values }
end end

View File

@@ -1,4 +1,3 @@
local lush = require "lush"
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.opt.background:get()
local p = require("zenwritten.palette")[bg] local p = require("zenwritten.palette")[bg]