summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-06 21:11:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-06 21:11:15 +0800
commitdf2f020ea023379f462ee5df861f708e69427994 (patch)
tree8c28cc637328ec181ad3fd76ec2de1ea4909186a /script
parente93c044cf4596184907a72d7be05ed0d0e29cfb8 (diff)
downloadlua-language-server-df2f020ea023379f462ee5df861f708e69427994.zip
fix
Diffstat (limited to 'script')
-rw-r--r--script/core/searcher.lua14
-rw-r--r--script/plugin.lua5
2 files changed, 19 insertions, 0 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 8c9f91e2..6ea15d97 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -84,6 +84,20 @@ local pushDefResultsMap = util.switch()
: case 'local'
: case 'setlocal'
: case 'setglobal'
+ : call(function (source, status)
+ if source.type ~= 'local' then
+ source = source.node
+ end
+ if source[1] == 'self'
+ and source.parent.type == 'funcargs' then
+ local func = source.parent.parent
+ if status.source.start < func.start
+ or status.source.start > func.finish then
+ return false
+ end
+ end
+ return true
+ end)
: case 'label'
: case 'setfield'
: case 'setmethod'
diff --git a/script/plugin.lua b/script/plugin.lua
index 3dbb1b66..21e05292 100644
--- a/script/plugin.lua
+++ b/script/plugin.lua
@@ -22,9 +22,14 @@ function m.dispatch(event, ...)
if type(method) ~= 'function' then
return false
end
+ local clock = os.clock()
tracy.ZoneBeginN('plugin dispatch:' .. event)
local suc, res1, res2 = xpcall(method, log.error, ...)
tracy.ZoneEnd()
+ local passed = os.clock() - clock
+ if passed > 0.1 then
+ log.warn(('Call plugin event [%s] takes [%.3f] sec'):format(event, passed))
+ end
if suc then
return true, res1, res2
else