StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Take into account size of function definition when formatting return type

Open JohnnyMorganz opened this issue 1 year ago • 2 comments

Update the shape before formatting return type

Closes #896

JohnnyMorganz avatar Nov 17 '24 15:11 JohnnyMorganz

Repo Comparison Test

diff --git ORI/CorePackages/modules/Collections/src/Array/map.lua ALT/CorePackages/modules/Collections/src/Array/map.lua
index 01b1443..88535aa 100644
--- ORI/CorePackages/modules/Collections/src/Array/map.lua
+++ ALT/CorePackages/modules/Collections/src/Array/map.lua
@@ -24,7 +24,9 @@ type callbackFnWithThisArg<T, U, V> = (thisArg: V, element: T, index: number, ar
 
 -- Implements Javascript's `Array.prototype.map` as defined below
 -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
-return function<T, U, V>(t: Array<T>, callback: callbackFn<T, U> | callbackFnWithThisArg<T, U, V>, thisArg: V?): Array<U>
+return function<T, U, V>(t: Array<T>, callback: callbackFn<T, U> | callbackFnWithThisArg<T, U, V>, thisArg: V?): Array<
+	U
+>
 	if _G.__DEV__ then
 		if typeof(t) ~= "table" then
 			error(string.format("Array.map called on %s", typeof(t)))

github-actions[bot] avatar Nov 17 '24 16:11 github-actions[bot]

Not a very nice diff. Need to solve that

JohnnyMorganz avatar Nov 17 '24 16:11 JohnnyMorganz