summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-19 01:18:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-19 01:18:40 +0800
commitbd3cd4a5d1cf8effcf8d8403372d59553245e026 (patch)
tree404ca77a7dd0ce9f7a7b0f451af80f576954c148 /script
parentf03bfa6794b0970dcfcc9043c02e541686085d3d (diff)
parente36ca2b3e0629a8f67b4b2af34e938f66661e788 (diff)
downloadlua-language-server-bd3cd4a5d1cf8effcf8d8403372d59553245e026.zip
Merge remote-tracking branch 'origin/master' into type-narrow
Diffstat (limited to 'script')
-rw-r--r--script/log.lua5
-rw-r--r--script/vm/field.lua11
2 files changed, 15 insertions, 1 deletions
diff --git a/script/log.lua b/script/log.lua
index 597bdc4e..6cb865c3 100644
--- a/script/log.lua
+++ b/script/log.lua
@@ -85,7 +85,10 @@ function m.warn(...)
end
function m.error(...)
- return pushLog('error', ...)
+ -- Don't use tail calls,
+ -- Otherwise, the count of `debug.getinfo` will be wrong
+ local msg = pushLog('error', ...)
+ return msg
end
function m.raw(thd, level, msg, source, currentline, clock)
diff --git a/script/vm/field.lua b/script/vm/field.lua
index ba7cd4c1..614dc89b 100644
--- a/script/vm/field.lua
+++ b/script/vm/field.lua
@@ -2,6 +2,7 @@
local vm = require 'vm.vm'
local util = require 'utility'
local guide = require 'parser.guide'
+local localID = require 'vm.local-id'
local searchByNodeSwitch = util.switch()
: case 'global'
@@ -15,6 +16,15 @@ local searchByNodeSwitch = util.switch()
pushResult(source)
end)
+local function searchByLocalID(source, pushResult)
+ local fields = localID.getFields(source)
+ if fields then
+ for _, field in ipairs(fields) do
+ pushResult(field)
+ end
+ end
+end
+
local function searchByNode(source, pushResult)
local uri = guide.getUri(source)
vm.compileByParentNode(source, nil, true, function (field)
@@ -35,6 +45,7 @@ function vm.getFields(source)
end
end
+ searchByLocalID(source, pushResult)
searchByNode(source, pushResult)
return results