diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-16 15:51:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-16 15:51:00 +0800 |
commit | bb22719db1a29096a58fb7ea1a1db00a5ccfce2a (patch) | |
tree | b047fa4915644601bec5d9991e5b5fd522c296c2 /script/core | |
parent | 0db905ab64b8e6486f04f5a48d4871eb14141379 (diff) | |
download | lua-language-server-bb22719db1a29096a58fb7ea1a1db00a5ccfce2a.zip |
`Lua.IntelliSense.traceReturn`
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/noder.lua | 4 | ||||
-rw-r--r-- | script/core/searcher.lua | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 999b797e..81a5b8b1 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1280,7 +1280,9 @@ compileNodeMap = util.switch() , index ) pushForward(noders, returnID, getID(rtnObj)) - pushBackward(noders, getID(rtnObj), returnID, INFO_DEEP_AND_DONT_CROSS) + if config.get 'Lua.IntelliSense.traceReturn' then + pushBackward(noders, getID(rtnObj), returnID, INFO_DEEP_AND_DONT_CROSS) + end end end end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 3c210b1b..f2b9b291 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -17,6 +17,7 @@ local next = next local error = error local type = type local setmetatable = setmetatable +local ipairs = ipairs local tconcat = table.concat local ssub = string.sub local sfind = string.find @@ -975,6 +976,22 @@ local function prepareSearch(source) end local uri = getUri(source) local id = getID(source) + -- return function + if source.type == 'function' and source.parent.type == 'return' then + local func = guide.getParentFunction(source) + if func.type == 'function' then + for index, rtn in ipairs(source.parent) do + if rtn == source then + id = sformat('%s%s%s' + , getID(func) + , RETURN_INDEX + , index + ) + break + end + end + end + end return uri, id end |