Skip to content

Commit 5da1b76

Browse files
committed
fix(extras.opencode): made opencode gen idempotent
1 parent 66d8d09 commit 5da1b76

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

lua/tokyonight/extra/fzf.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
local util = require("tokyonight.util")
2-
31
local M = {}
42

53
--- @param colors ColorScheme
@@ -46,7 +44,6 @@ function M.generate(colors)
4644
if vim.fn.hlexists(v[2]) == 1 then
4745
hl_group = v[2]
4846
end
49-
print(hl_group)
5047
assert(hl_group, "hl_group not found for " .. v[2])
5148
local hl = vim.api.nvim_get_hl(0, { name = hl_group, link = false })
5249
assert(hl, "hl not found for " .. hl_group)
@@ -75,6 +72,4 @@ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \
7572
"
7673
]]
7774

78-
print(M.generate())
79-
8075
return M

lua/tokyonight/extra/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ M.extras = {
5454
}
5555

5656
function M.setup()
57-
local tokyonight = require("tokyonight")
57+
local tokyonight = require("tokyonight.theme")
5858
vim.o.background = "dark"
5959

6060
-- map of style to style name
@@ -74,7 +74,7 @@ function M.setup()
7474
local info = M.extras[extra]
7575
local plugin = require("tokyonight.extra." .. extra)
7676
for style, style_name in pairs(styles) do
77-
local colors, groups, opts = tokyonight.load({ style = style, plugins = { all = true } })
77+
local colors, groups, opts = tokyonight.setup({ style = style, plugins = { all = true } })
7878
local fname = extra
7979
.. (info.subdir and "/" .. info.subdir .. "/" or "")
8080
.. "/tokyonight"

lua/tokyonight/extra/opencode.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ local M = {}
77
local function generate_defs(colors)
88
local defs = {}
99

10-
for key, value in pairs(colors) do
10+
local keys = vim.tbl_keys(colors)
11+
table.sort(keys)
12+
for _, key in ipairs(keys) do
13+
local value = colors[key]
1114
-- Skip keys that start with underscore (metadata) and "none"
1215
if not key:match("^_") and key ~= "none" then
1316
if type(value) == "string" then

lua/tokyonight/theme.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
local Util = require("tokyonight.util")
2-
31
local M = {}
42

53
---@param opts? tokyonight.Config

0 commit comments

Comments
 (0)