StyLua-Roblox: Roblox Plugin For StyLua Formatter

StyLua Roblox


Introduction

StyLua is a formatter for lua/luau, StyLua-Roblox is a plugin to use StyLua in Roblox Studio.

Features

Compared to roblox’s format document feature, StyLua offers lot of different formatting configuration.

more information about the details of each option can be found here

Installation

Usage

Once installed, you can run the program and use the plugin on Studio, You need to run the program at background while using the plugin.

(program runs at your system tray)

To Format, click the StyLua button or bind a shortcut from shortcut settings.

format_final

Formatting with a script editor open will format the current script.

To format multiple scripts, close the script editor and select the scripts you want to format from Explorer and format.

To Change the Configuration of StyLua, Click the Open Settings Button.

These settings are user only and will be used when there is no place-only setting.

To Create Place-only Settings, Add a module named StyLua (case-sensitive) to ServerStorage.

Copy the Settings from Open Settings menu and paste it in, plugin will use these settings.

Place-only settings are useful for keeping the settings consistent for users in the teamcreate.

23 Likes

This is pretty nice, I’m definitely gonna use this

6 Likes

in your examples you do something weird methods to achieve your “long string.”

You can do multiple lines using [[ ]]

for example:

local longString = [[ hello world
I love pizza
Yay]]

print(longString)

All of the other stuff you do is done by roblox automatically when you copy and paste a script. I feel like you wasted your time making this.

4 Likes

I personally dont use studio editor that much but seems like this plugin is gonna improve studio editor experience a lot

5 Likes

The code in the example demonstrates line breaking on concat, not multiline strings.
Studio’s default formatting does not have opiniated features since it is made to be used without any setting.

Also, the examples are using default settings which is suppose to be as default as possible, while giving you option to config as you like.

you might want to check out before giving your “feedback”

6 Likes

I still cant see a purpose. I think it should instead organize the code, convert names to camelCase, and other formatting things roblox doesn’t do automatically.

4 Likes

My god. I’ve been using JohnyMorganz’ stylua (on VSCode). But now on studio? Now this is 2024!

6 Likes

V1.2.0

Changelog

Bumped StyLua to 0.20.0

1 Like

I was wondering if there was a code formatter for Roblox Studio, after a fast google search i found this amazing plugin.

1 Like

@B_arocena, why did downloading the latest version of StyLua-Roblox.exe from your GitHub releases page result in my anti-virus software detecting malware connected to it??


it is probably due to exe being not signed or native calls to hide terminal and put the app to trayicon

if you dont want to download it, feel free to check index.js and build the exe yourself (node build.js)

1 Like

No I don’t mind, but what I can’t understand is the fact the keyword “FileRepMalware” was brought up. If it’s something weird my antivirus is bringing up then yeah, I can understand.

V1.3.0

Changelog

  • Bumped StyLua to 2.1.0
  • Added space_after_function_names config

space config might not appear on roblox plugin settings page due to cached settings, you can add it manually like this
space_after_function_names = "Always", --| Never, Definitons, Calls, Always |