Comments (3)
I'll be honest, it's been a while since I've worked on the code and don't have the time to check properly right now (half of this post is really notes to future me), but my test:
describe "#69", ->
it "errors", ->
base = parse -> {
A { fg: "#00FF00", gui: "italic" }
}
spec = parse -> {
A { base.A, gui: nil }
}
Gives the error:
user bugs #69 errors
./lua/lush/parser.lua:1: {
code = "circular_self_link",
msg = "Attempt to link self",
on = "A"
}
Off the top of my head,
gui = nil
is probably ending up as a no-op/getting stripped.- (perhaps this is an oversight or perhaps the preferred way is actually redefining the rule with all keys, will have to think about that.)
- so
A { base.A, gui = nil } == A { base.A }
which is illegal (circular self link).
So the parser can't rectify the spec and somewhere it's failing to check for errors or perhaps just cant surface the error context properly.
Anyway, if you gui = "NONE"
, you force the key to be set to a value and the error doesn't happen.
For your user, you might have to wrap the mini-spec in a Colorscheme
autocommand (check exact name) so the mini-spec is applied after the normal colorscheme since it's not executed in an obvious order. That's a neat trick I hadn't thought of doing, just passing a small patch of highlights to apply
, good use of the internal tool chain!
extends/merge
is the prescribed way to do it for bigger changesets but the small patch is a nice way too. Extends/merge sets up a proper parent scope, which is probably why the error doesn't show up in that case, but I would have to look into it.
That should keep you moving, but it is a bug, at least in not showing a useful error if nothing else.
from lush.nvim.
Getting my brain back in Lua mode, I am thinking:
key = nil
is the same as not having the key in a lua table (IIRC)- so when I request/
pairs()
the keys given for a highlight group, lua doesn't returngui
because it'snil
, as good as not being in the table - so the highlight only has a group name and changes from an
inherit
rule into a linkrule
.
I bet if you set gui = nil, fg = "#11111"
it probably works fine because a key exists and it stays as an inherit
rule instead of becoming a link
.
Nils are ok to reach the compiler, they get coerced into "NONE"
lush.nvim/lua/lush/compiler.lua
Lines 6 to 10 in 63e11d9
Not 100% if I can actually check for this, since checking if a key is nil would probably break the whole link idea cause everything would look like an inherit without checking all the way up chains for differences.
Probably the fix will just be surfacing the error and documenting that key = "NONE"
is the correct way to unset a value.
from lush.nvim.
Anyway, if you
gui = "NONE"
, you force the key to be set to a value and the error doesn't happen.
This works! I should have thought of this in the first place. Not sure why I went with nil
.
I'll probably make this mcchrish/zenbones.nvim#14 (comment) the recommended way for simple overrides. It's much more flexible but still simple to write. I first considered showing the extend/merge way but that seems to large of an apply/compile
for one override.
from lush.nvim.
Related Issues (20)
- parser.lua error HOT 3
- Unreliable Lushify behaviour HOT 1
- Using new Treesitter groups/tags HOT 4
- How to specify treesitter highlight groups? HOT 2
- How to define treesitter `@x.y` groups HOT 14
- Transparent function HOT 4
- separate colors for keywords and brackets in JavaScript? HOT 3
- Theme the nvim-cmp HOT 2
- `:LushImport` broken HOT 5
- `:Lushify` doesn't work with `lush.extends()` HOT 2
- Built-in support for `g:terminal_color_*` variables HOT 1
- Following the guide to configure an existing theme removes icon colors HOT 7
- Changing boilerplate `sed` code results in error in Mac HOT 4
- `Cursor` highlight group appears not to be working HOT 1
- HSV support ? HOT 2
- `LushImport` doesn't work and errors saying bad argument HOT 3
- slow startup time HOT 8
- Cannot add colour variation for filetype sh HOT 4
- Add warning in :LushRunTutorial to avoid loss of work with naive `:w`'s HOT 1
- Error `bad argument #1 to 'unpack' (table expected, got nil)` HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lush.nvim.