Repository navigation
convert: don't emit config tables with nothing in them - #18
Merged
Merged
Conversation
A block whose every key was TODO'd out (or that was empty in the source)
still produced `hl.config({ <name> = {} })`. That sets nothing, and when
the block name itself is unresolvable - a per-device `device:foo` block,
which Hyprland's default config ships as a commented example - the
leftover table was flagged by convert's own post-convert checker, so the
command exited 1 on a file it had handled exactly as designed.
Prune empty tables at both levels (top-level block and nested sub-block)
and keep the TODO note, matching what the plugin-block path already did.
Found running the converter against a real config from the wild.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A config block whose every key was TODO'd out (or that was empty in the source) still emitted
hl.config({ <name> = {} }).Two problems with that:
convert's own post-convert validation flags it and the command exits 1 — on a file it handled exactly as designed.The clearest instance is a per-device block, which Hyprland's own default config ships as a commented example, so it's widespread:
device:epic-mouse-v1 { sensitivity = -0.5 }Before: TODO comment emitted (correct), plus
hl.config({ ["device:epic-mouse-v1"] = {} }), then1 issue(s) found in the converted output.and exit 1.After: TODO comment only, exit 0.
How
Prune empty tables at both levels — the top-level block and nested sub-blocks — and keep the TODO note. This is the same call the
pluginblock path already made ("flag for manual conversion rather than emitting empty/invalid tables"); it just wasn't applied to the general config path.Keys that did convert are untouched — covered by a test.
Verification
173 passed(was 170; +3 new tests)site/bundle.jsregenerated (mapper.pyis a bundled module).