diff options
-rw-r--r-- | script/core/searcher.lua | 14 | ||||
-rw-r--r-- | script/plugin.lua | 5 | ||||
-rw-r--r-- | test/definition/luadoc.lua | 10 |
3 files changed, 29 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 diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 22a51845..5f8c11ee 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -682,3 +682,13 @@ local t print(t.<?xx?>) ]] + +TEST [[ +---@class A +local <!t!> + +t.f = function (self) +end + +<?t?> +]] |