-
Notifications
You must be signed in to change notification settings - Fork 94
Check for inline comments that will force hanging in function arguments #1025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Any updates on this? This sadly is a dealbreaker for me which prevents me from using |
499dff8 to
9d3c65b
Compare
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.
…unction-arguments-inline-comments
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
Repo Comparison Testdiff --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
|
Owner
Author
|
Going to accept this external diff, overall seems to be a net positive. |
|
Thank you 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #996