Closed rktjmp closed 3 years ago
Pretty major bug where
base = parse -> {
A { bg: "a_bg" , fg: "a_fg" },
Z { bg: "z_bg", fg: "z_fg" }
}
base_2 = parse((-> {
A { fg: A.bg },
B { bg: "arst", fg: "rsast" }
X { Z, fg: "x_z_fg" }
}), {extends: {base}})
will collapse because we try to define an existing group. I think this use case is actually pretty natural to fall into.
Can get around with some code changes and
base = parse -> {
A { bg: "a_bg" , fg: "a_fg" },
Z { bg: "z_bg", fg: "z_fg" }
}
base_2 = parse((-> {
A { fg: base.A.bg },
B { bg: "arst", fg: "rsast" }
X { Z, fg: "x_z_fg" }
}), {extends: {base}})
but it makes the API inconsistent. May disable automatic lookup in favour of always using base.Group
which is less magical, for better or worse.
Prefer base.Group
syntax in https://github.com/rktjmp/lush.nvim/commit/39ef2bf99bdb383397db4e0caad1ec0cbc232f4e
Example for docs
nord = require('lush_theme.nord)
lush.extend(nord).with(function()
return {
-- i like nord but need brighter normal text
Normal { fg = nord.Normal.fg.li(30) },
Comment { fg = colorblind_safe_green } -- also I cant see normal color
MyPlug { ... } -- and I want my custom local plugin to mirror some nord settings.
}
end)
Generally needs a "bang" fn at the end to roll up all the specs.
extends(specs).with(spec)
, most semantic in my mind (but i wrote it so that seems obvious).
chain(specs).combine(spec)
, suggestion but I am not sold on it.
merge(specs).into(spec)
, relationship is a bit inverse "into"
lush(spec).merge_with/onto(specs)
puts parents at the end which may be many loc down.
Possibly have two styles
extends(specs).with(spec)
for alteration, merge(specs)
auto bangs, merge to me reads as an verb not an... adverb?
Could also just allow extends(specs).with(nil)
but I would almost expect that to return nothing.
:shipit:
8 #23
Example?Elected for no hard example in
examples/
but see:h lush-extending-specs
and