Skip to content

Conversation

@JohnnyMorganz
Copy link
Owner

Fixes #996

@CatsDeservePets
Copy link

CatsDeservePets commented Dec 28, 2025

Any updates on this? This sadly is a dealbreaker for me which prevents me from using StyLua.

@JohnnyMorganz JohnnyMorganz force-pushed the function-arguments-inline-comments branch from 499dff8 to 9d3c65b Compare January 24, 2026 13:24
The previous implementation used contains_comments(lhs) which checked
all tokens in the entire LHS tree, incorrectly detecting comments
inside nested function bodies as "inline" comments of the outer binary
expression.

Now we only check for comments that are actually inline within the
binary expression: trailing comments on LHS, leading comments on RHS,
and recursively check nested compound expressions.
@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

Repo Comparison Test

diff --git ORI/neovim/runtime/lua/tohtml.lua ALT/neovim/runtime/lua/tohtml.lua
index 4deef7c..61ea734 100644
--- ORI/neovim/runtime/lua/tohtml.lua
+++ ALT/neovim/runtime/lua/tohtml.lua
@@ -744,8 +744,7 @@ local function styletable_statuscolumn(state)
     signcolumn = 'auto'
   end
   if signcolumn ~= 'no' then
-    local max = tonumber(signcolumn:match('^%w-:(%d)')) --[[@as integer?]]
-      or 1
+    local max = tonumber(signcolumn:match('^%w-:(%d)')) --[[@as integer?]] or 1
     if signcolumn:match('^auto') then
       --- @type table<integer,integer>
       local signcount = {}
@@ -772,8 +771,7 @@ local function styletable_statuscolumn(state)
   local foldcolumn = state.opt.foldcolumn
   if foldcolumn ~= '0' then
     if foldcolumn:match('^auto') then
-      local max = tonumber(foldcolumn:match('^%w-:(%d)')) --[[@as integer?]]
-        or 1
+      local max = tonumber(foldcolumn:match('^%w-:(%d)')) --[[@as integer?]] or 1
       local maxfold = 0
       vim._with({ buf = state.bufnr }, function()
         for row = state.start, state.end_ do
diff --git ORI/neovim/runtime/lua/vim/treesitter/query.lua ALT/neovim/runtime/lua/vim/treesitter/query.lua
index cdb29fd..a3c8ddb 100644
--- ORI/neovim/runtime/lua/vim/treesitter/query.lua
+++ ALT/neovim/runtime/lua/vim/treesitter/query.lua
@@ -653,14 +653,10 @@ local directive_handlers = {
     end
 
     metadata[capture_id].offset = {
-      pred[3] --[[@as integer]]
-        or 0,
-      pred[4] --[[@as integer]]
-        or 0,
-      pred[5] --[[@as integer]]
-        or 0,
-      pred[6] --[[@as integer]]
-        or 0,
+      pred[3] --[[@as integer]] or 0,
+      pred[4] --[[@as integer]] or 0,
+      pred[5] --[[@as integer]] or 0,
+      pred[6] --[[@as integer]] or 0,
     }
   end,
   -- Transform the content of the node
diff --git ORI/neovim/src/gen/luacats_grammar.lua ALT/neovim/src/gen/luacats_grammar.lua
index f382ec8..f013dae 100644
--- ORI/neovim/src/gen/luacats_grammar.lua
+++ ALT/neovim/src/gen/luacats_grammar.lua
@@ -160,8 +160,8 @@ local typedef = P({
   fun = opt(Pf('async')) * Pf('fun') * paren(comma(v.fun_param)) * opt(Pf(':') * comma1(v.fun_ret)),
   generics = P(ty_ident) * Pf('<') * comma1(v.type) * Plf('>'),
 }) / function(match)
-    return vim.trim(match):gsub('^%((.*)%)$', '%1'):gsub('%?+', '?')
-  end
+  return vim.trim(match):gsub('^%((.*)%)$', '%1'):gsub('%?+', '?')
+end
 
 local access = P('private') + P('protected') + P('package')
 local caccess = Cg(access, 'access')
diff --git ORI/zombie-strike/src/shared/ReplicatedStorage/Core/Color3Lerp.lua ALT/zombie-strike/src/shared/ReplicatedStorage/Core/Color3Lerp.lua
index fef9537..2e31ad6 100644
--- ORI/zombie-strike/src/shared/ReplicatedStorage/Core/Color3Lerp.lua
+++ ALT/zombie-strike/src/shared/ReplicatedStorage/Core/Color3Lerp.lua
@@ -84,9 +84,7 @@ return function(c0, c1, t)
 
 	return Color3.new(
 		-- Clamp the result
-		r > 1 and 1
-			or r < 0 and 0
-			or r,
+		r > 1 and 1 or r < 0 and 0 or r,
 		g > 1 and 1 or g < 0 and 0 or g,
 		b > 1 and 1 or b < 0 and 0 or b
 	)
diff --git ORI/CorePackages/modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactChildFiber.new.lua ALT/CorePackages/modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactChildFiber.new.lua
index 4e7d907..7a3be37 100644
--- ORI/CorePackages/modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactChildFiber.new.lua
+++ ALT/CorePackages/modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactChildFiber.new.lua
@@ -153,20 +153,16 @@ function coerceRef(returnFiber: Fiber, current: Fiber | nil, element: ReactEleme
 			else
 				componentName = "<enable __DEV__ mode for component names>"
 			end
-			error(
-				Error.new(
-					string.format(
-						'Component "%s" contains the string ref "%s". Support for string refs '
-							-- ROBLOX deviation: we removed string ref support ahead of upstream schedule
-							.. "has been removed. We recommend using "
-							.. "useRef() or createRef() instead. "
-							.. "Learn more about using refs safely here: "
-							.. "https://reactjs.org/link/strict-mode-string-ref",
-						componentName,
-						tostring(mixedRef)
-					)
-				)
-			)
+			error(Error.new(string.format(
+				'Component "%s" contains the string ref "%s". Support for string refs '
+					-- ROBLOX deviation: we removed string ref support ahead of upstream schedule
+					.. "has been removed. We recommend using "
+					.. "useRef() or createRef() instead. "
+					.. "Learn more about using refs safely here: "
+					.. "https://reactjs.org/link/strict-mode-string-ref",
+				componentName,
+				tostring(mixedRef)
+			)))
 		end
 
 		if not element._owner then

@JohnnyMorganz
Copy link
Owner Author

Going to accept this external diff, overall seems to be a net positive.

@JohnnyMorganz JohnnyMorganz merged commit 8314c09 into main Jan 24, 2026
21 checks passed
@JohnnyMorganz JohnnyMorganz deleted the function-arguments-inline-comments branch January 24, 2026 16:18
@Hzj-jie
Copy link

Hzj-jie commented Jan 24, 2026

Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combination of comment, quote, single quote and lambda introduces syntax error

4 participants