Codify - Convert to TypeScript, Fusion, React, Luau

For the latter bug, here’s a more ‘complete’ solution:

local specialCharacters = {["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n", ["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v", ["\0"] = "\\0"}
local keywords = { ["and"] = true, ["break"] = true, ["do"] = true, ["else"] = true, ["elseif"] = true, ["end"] = true, ["false"] = true, ["for"] = true, ["function"] = true, ["if"] = true, ["in"] = true, ["local"] = true, ["nil"] = true, ["not"] = true, ["or"] = true, ["repeat"] = true, ["return"] = true, ["then"] = true, ["true"] = true, ["until"] = true, ["while"] = true, ["continue"] = true}

local function GetSafeName(instance: Instance)
	local name = string.gsub(instance.Name, "[%c%z]", specialCharacters)
	if keywords[name] or not string.match(name, "^[_%a][_%w]*$") then
		name = string.format("[\"%s\"]", name)
	end

	return name
end

GetSafeName({Name="break"}) --> ["break"]
GetSafeName({Name="1var"}) --> ["1var"]
GetSafeName({Name="v1ar"}) --> v1ar
GetSafeName({Name="\n"}) --> ["\n"]
GetSafeName({Name="1"}) --> ["1"]
GetSafeName({Name="h"}) --> h
2 Likes

thanks for the reports (and solutions!), I’ll look into this when I can :relaxed:

Can we have support to Rojo JSON Models?

2 Likes

I don’t see why not. that looks like a good way to serialise the data before converting it to Luau, so I may switch over to that internally and give the option to expose it

I’m currently working on an update to Codify to fix a bunch of bugs, and add a few new features, so I’ll be sure to add this to the to-do list

3 Likes

Version 2.2.4-patch.1

Get on Roblox Get on Itch.io Get source code on GitHub

This is an unofficial patch. The source for this patch has not been uploaded to GitHub, but will feature in the next update to the minor version (v2.3.0), which will also address more bugs and include a few new features :eyes:. Plugin binaries are released on the plugin marketplace and Itch.io.

This is also a reminder that Codify now costs :robux_gold: 350 via the Plugin Marketplace (and is now listed in the toolbox!), but can still be obtained for free via the Itch store page (optional donation), or by building from source—The GitHub README has not yet been updated to reflect this.

Finally, thank you so much for 1,000+ installs via Roblox! Please don’t forget to give the plugin a :+1: thumbs up if you’re enjoying it.

image

What’s Changed

  • Patched number converter.

Fixed

  • [Internal] Instances which allowed inf/-inf values would serialise as “inf”. This is a minor patch to convert those values to math.huge and -math.huge, respectively.
2 Likes

Version 2.2.4-patch.2

Get on Roblox Get on Itch.io Get source code on GitHub

This is another unofficial patch. The source for this patch has not been uploaded to GitHub, but will feature in the next update to the minor version (v2.3.0), which will also address more bugs and include a few new features :eyes:. Plugin binaries are released on the plugin marketplace and Itch.io.

Please don’t forget to give the plugin a :+1: thumbs up if you’re enjoying it.

What’s Changed

This patch now uses the new FontFace property to serialise fonts on TextLabels, TextButtons and TextBoxes. In settings, you’ll find the option to switch between “Smart” and “Full” formatting—The default configuration is “Full.”

You can read more about the changes to GUI Fonts here:

Example outputs:

In a scenario where a TextLabel uses the font “Gotham SSm” in Bold.

image

-- Full formatting:
FontFace = Font.new(
  "rbxasset://fonts/families/GothamSSm.json",
  Enum.FontWeight.Bold,
  Enum.FontStyle.Normal
),

-- Smart formatting:
FontFace = Font.fromEnum(Enum.Font.GothamBold),

If “Smart” cannot find an Enum for the selected font, it’ll fallback to Full formatting. Additionally, if the weight and style of the font are set to their default values, the weight and style Enums will be omitted from the result:

Example output 2:

In a scenario where a TextLabel uses the font “Gotham SSm” with normal weight and styles:

image

-- Full formatting:
FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json"),

Added

Removed

4 Likes

Version 2.2.4-patch.3

Get on Roblox Get on Itch.io Get source code on GitHub

GitHub’s source code is now parallel with the plugin’s source code. The README has also been updated to reflect changes to pricing and other information.

Versions with the “-patch” suffix prior to v2.2.4-patch.3 are not available on GitHub. This is due to the way the reconciliation was performed.


This is a minor patch which bumps the version of most dependencies, with a focus on Highlighter. Please report any issues that may occur with the latest version, as Highlighter’s behaviour was previously unstable on v0.4.6. I have not personally run into any problems with the current version.

A full update is planned, but has been delayed due to personal issues. Keep an eye on this thread or Twitter to keep up to date with development.

1 Like

I recently bought the plugin - however - whenever I run “Generate Snippet” it yields for a while before warning in the output Failed to get changed properties: Request timed out.

Thanks for the report! I’ve already had one other user report this issue, so I’ll look into this ASAP and get a patch pushed out for it.

2 Likes

Version 2.2.5

Get on Roblox Get on Itch.io Get source code on GitHub

It’s been a while! The latest update addresses a few bugs reported by users (thanks @Ulferno, @PysephDEV, and others!). Codify also has a new section for experimental features—Use this at your own risk!

And don’t worry, updates are still in the works for Codify. No timeline, but I’d love for Codify to support Rojo’s JSON model format and TypeScript TSX support in the future. I’m also planning a UI overhaul to clean up the settings tab, and further customisation options to enable you to generate snippets to your own preferences.

You can also follow me on Twitter if you’d like to keep up to date with development.

What’s Changed

Fixed

  • Issue #31: Some users found it confusing when Codify truncated a snippet when generating excessively large snippets. This is purely because of a limit on Roblox’s TextBoxes. If a snippet is truncated, Codify will now display a message above the snippet informing the user of this, and will advise the user to save the snippet to their device in order to view the full text.
  • Issue #30: Sometimes Codify would yield for a long time when fetching API data. HTTP requests have had their timeouts lowered to 15s, and will additionally display an error message on the home tab when something goes wrong.
  • Issue #28: Multiline strings were not handled correctly in previous versions. They will now be enclosed within double square brackets ([[ ... ]]). Any instances of closing double square brackets within multiline strings will be escaped.

Added

  • Experimental settings section within the settings tab.
  • Parallel Luau experiment - This makes use of the new task.synchronize and task.desynchronize methods to help prevent Studio from becoming unresponsive or crashing when generating excessively large snippets.

Changed

  • Minor visual/apperance changes.
  • [Internal] Changed the spelling of “colour” to the US spelling “color” within props. This keeps it consistent with structures like Color3, which use the US variant, and removes any confusion for potential contributors.

Removed

  • Removed separate icons for different builds of Codify. Sometimes Codify would show the icon for unstable builds when manually installing the plugin from places like GitHub or Itch.io.

Full Changelog: 2.2.4-patch.3...2.2.5

4 Likes

Version 2.3.0

Get on Roblox Get on Itch.io Get source code on GitHub

This is only a small update to Codify, but will deliver improved speeds and more reliable variable names.

What’s Changed

Changed

  • Performance improvements
  • Back-ported SafeNamer from the work-in-progress Codify v3

Full Changelog: 2.2.5...2.3.0

3 Likes

Version 2.4.0

Get on Roblox Get on Itch.io Get source code on GitHub

What’s Changed

Added

  • Case Format option for variable names/children keys—choose from one of PascalCase, camelCase, lowercase or uppercase

Changed

  • Increased timeout for API dump HTTP requests to 60 seconds
  • Improved output values of SafeNamer (variable name generator)

Full Changelog: 2.3.0...2.4.0

3 Likes

Is it possible to add a rounding option for numbers to the settings, to get rid of things like this

I think you meant to post this here

1 Like

OH SORRY
I’m sorry. I was confused.
Anyway, Codify is also very AWESOME

1 Like

I’ve noticed Codify does not preserve the name property - is this intentional behaviour?

do you mean when generating React/Roact snippets? if so, yes. React ignores the Name property, so it’s intentionally omitted from the generated props table

If anyone’s confused about why the plugin costs 1000 robux, don’t use the marketplace one, use the one from itch.io or github

though this is cool if I want to put up particles in the code

I’d pay 1000 robux just to look at the awesome UI for this plugin. It’s so good! :innocent:

3 Likes

Me too but im too broke, but I’m not forcing anyone to not buy it, It’s their choice, for now i’d use itch.io for that

1 Like