From bc71cdd4e6a3e9ee80d60e7186a3a445d4e854f2 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 10 Oct 2022 12:31:43 +1100 Subject: [PATCH] fix(plugin): ignore line-break during in unpacking It is valid syntax but this is just a lazy workaround (for now?) for #13. --- Lua/plugin.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lua/plugin.lua b/Lua/plugin.lua index b33c0a3..9f84f33 100644 --- a/Lua/plugin.lua +++ b/Lua/plugin.lua @@ -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] = {