Skip to content

Commit

Permalink
Improve visualization for arrays (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber authored Jan 2, 2024
1 parent 3369b0d commit fd8bc8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Rojo Changelog

## Unreleased Changes
* Improved the visualization for array properties like Tags ([#829])
* Significantly improved performance of `rojo serve`, `rojo build --watch`, and `rojo sourcemap --watch` on macOS. [#830]

[#829]: https://github.com/rojo-rbx/rojo/pull/829
[#830]: https://github.com/rojo-rbx/rojo/pull/830

## [7.4.0-rc3] - October 25, 2023
Expand Down
17 changes: 16 additions & 1 deletion plugin/src/App/Components/PatchVisualizer/DisplayValue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,23 @@ local function DisplayValue(props)
elseif next(props.value) == nil then
-- If it's empty, show empty braces
textRepresentation = "{}"
elseif next(props.value) == 1 then
-- We don't need to support mixed tables, so checking the first key is enough
-- to determine if it's a simple array
local out, i = table.create(#props.value), 0
for k, v in props.value do
i += 1

-- Wrap strings in quotes
if type(v) == "string" then
v = '"' .. v .. '"'
end

out[i] = tostring(v)
end
textRepresentation = "{ " .. table.concat(out, ", ") .. " }"
else
-- If it has children, list them out
-- Otherwise, show the table contents as a dictionary
local out, i = {}, 0
for k, v in pairs(props.value) do
i += 1
Expand Down

0 comments on commit fd8bc8a

Please sign in to comment.