Skip to content

Commit 72dc028

Browse files
committed
Fix bugs with recent changes
1 parent e389df8 commit 72dc028

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

server/script/core/completion.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -747,20 +747,27 @@ local function checkStringCommon(myUri, word, text, offset, results)
747747
cache.stringCommonWords = {}
748748
local ast = files.getAst(uri)
749749
if ast then
750+
local mark = {}
750751
guide.eachSourceType(ast.ast, "string", function (src)
751752
local str = src[1]
752-
if str:match("^[%a_][%w_]+$") and not used[str] and str ~= word then
753-
used[str] = true
754-
if word == "" or matchKey(word, str) then
755-
results[#results+1] = {
756-
label = str,
757-
kind = define.CompletionItemKind.Text,
758-
}
759-
end
753+
if str and not mark[str] and str:match("^[%a_][%w_]+$") then
754+
mark[str] = true
755+
cache.stringCommonWords[#cache.stringCommonWords+1] = str
760756
end
761757
end)
762758
end
763759
end
760+
for _, str in ipairs(cache.stringCommonWords) do
761+
if not used[str] and str ~= word then
762+
used[str] = true
763+
if word == "" or matchKey(word, str) then
764+
results[#results+1] = {
765+
label = str,
766+
kind = define.CompletionItemKind.Text,
767+
}
768+
end
769+
end
770+
end
764771
::CONTINUE::
765772
end
766773
end

server/script/library/rojo.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ function rojo:projectChanged(change)
307307
if change.type == define.FileChangeType.Changed
308308
and not filename:match("%.meta%.json$")
309309
and not filename:match("%.model%.json$")
310-
and not filename:match("%.project%.json$")
311-
and not filename:match("%.lua[u]?$") then
310+
and not filename:match("%.project%.json$") then
312311
return false
313312
end
314313
return true

server/script/parser/grammar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ Loop <- LoopBody
562562
LoopBody <- FOR LoopArgs NeedDo
563563
{} {| (!END Action)* |}
564564
NeedEnd
565-
LoopArgs <- MustName TypeAnn? AssignOrEQ
565+
LoopArgs <- MustName (TypeAnn / %nil) AssignOrEQ
566566
({} {| (COMMA / !DO !END Exp->NoNil)* |} {})
567567
-> PackLoopArgs
568568

0 commit comments

Comments
 (0)