diff options
| author | William Boman <william@redwill.se> | 2024-07-17 01:01:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-16 23:01:10 +0000 |
| commit | e2f7f9044ec30067bc11800a9e266664b88cda22 (patch) | |
| tree | fae08686912f09085b8d927d742eb33cc111c1e9 | |
| parent | fix(pypi): prefer stock python3 if it satisfies version requirement (#1736) (diff) | |
| download | mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar.gz mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar.bz2 mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar.lz mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar.xz mason-e2f7f9044ec30067bc11800a9e266664b88cda22.tar.zst mason-e2f7f9044ec30067bc11800a9e266664b88cda22.zip | |
fix(ui): fix rendering JSON schemas (#1757)
Fixes #1741.
| -rw-r--r-- | lua/mason/ui/components/json-schema.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lua/mason/ui/components/json-schema.lua b/lua/mason/ui/components/json-schema.lua index 0d24099e..73f8e558 100644 --- a/lua/mason/ui/components/json-schema.lua +++ b/lua/mason/ui/components/json-schema.lua @@ -112,8 +112,8 @@ local function JsonSchema(pkg, schema_id, state, schema, key, level, key_width, return Ui.Node(_.map(function(sub_schema) return JsonSchema(pkg, schema_id, state, sub_schema) end, schema)) - else - -- Leaf node (aka any type that isn't an object) + elseif level > 0 then -- Leaf nodes cannot occupy the root level. + -- Leaf node (aka any type that isn't an object). local type = resolve_type(schema) local heading local label = (key_prefix .. key .. (" "):rep(key_width or 0)):sub(1, key_width + 5) -- + 5 to account for key_prefix plus some extra whitespace @@ -175,6 +175,8 @@ local function JsonSchema(pkg, schema_id, state, schema, key, level, key_width, }) end), } + else + return Ui.Node {} end end |
