summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-29 16:02:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-29 16:02:15 +0800
commit46910e464bfab9992895898b4c1795e494796e39 (patch)
tree4a8580f9fa9d983b3a6f932a24011668d4938a67 /script/vm
parent72fccb749b959881011e0ab0830c11917bfc3c55 (diff)
downloadlua-language-server-46910e464bfab9992895898b4c1795e494796e39.zip
resolve #1248 supports spaces before `--[[@as]]`
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 549ace71..5a306308 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -585,12 +585,12 @@ local function bindAs(source)
ases = {}
docs._asCache = ases
for _, doc in ipairs(docs) do
- if doc.type == 'doc.as' and doc.as then
+ if doc.type == 'doc.as' and doc.as and doc.touch then
ases[#ases+1] = doc
end
end
table.sort(ases, function (a, b)
- return a.start < b.start
+ return a.touch < b.touch
end)
end
@@ -609,7 +609,7 @@ local function bindAs(source)
end
index = left + (right - left) // 2
local doc = ases[index]
- if doc.originalComment.start < source.finish + 2 then
+ if doc.touch < source.finish then
left = index + 1
else
right = index
@@ -617,7 +617,7 @@ local function bindAs(source)
end
local doc = ases[index]
- if doc and doc.originalComment.start == source.finish + 2 then
+ if doc and doc.touch == source.finish then
vm.setNode(source, vm.compileNode(doc.as), true)
return true
end