Skip to content

Commit

Permalink
fix(plugin): ignore line-break during in unpacking
Browse files Browse the repository at this point in the history
It is valid syntax but this is just a lazy workaround (for now?) for #13.
  • Loading branch information
thelindat committed Oct 10, 2022
1 parent 9c824bc commit bc71cdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lua/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function OnSetText(uri, text)
end

-- prevent diagnostic errors from in unpacking (a, b, c in t)
for vars, inPos, afterInPos, tablePos, tableName, finishPos in str_gmatch(text, '([_%w, ]*)%s+()in()%s+()([_%w]*%s-%(?.-%)?)()') do
if not str_find(vars, '^%s*for%s') then
for vars, inPos, afterInPos, tablePos, tableName, finishPos in str_gmatch(text, '([_%w, ]*)%s+()in()[ ]+()([_%w]*%s-%(?.-%)?)()') do
if #tableName > 0 and not str_find(vars, '^%s*for%s') then
-- replace 'in' with '='
count = count + 1
diffs[count] = {
Expand Down

0 comments on commit bc71cdd

Please sign in to comment.