summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-11 21:14:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-11 21:14:54 +0800
commita3c0d6ad25dbab739b10d4fe7019a99d4990f62f (patch)
tree216cfec293bf223fdca1db2b1c17dc1ce34e6d9d /script/core
parenta88c6796f2ab2ac3b3ff2419ab1cfdcb5518013f (diff)
downloadlua-language-server-a3c0d6ad25dbab739b10d4fe7019a99d4990f62f.zip
improve
Diffstat (limited to 'script/core')
-rw-r--r--script/core/noder.lua12
-rw-r--r--script/core/searcher.lua4
2 files changed, 15 insertions, 1 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index c2f2061a..893c5cac 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -13,6 +13,7 @@ local ssub = string.sub
local sformat = string.format
local sgsub = string.gsub
local smatch = string.match
+local sfind = string.find
_ENV = nil
@@ -1380,6 +1381,17 @@ function m.isCommonField(field)
return true
end
+---是否是普通的field,例如数字或字符串,而不是函数返回值等
+function m.hasCall(field)
+ if not field then
+ return false
+ end
+ if sfind(field, RETURN_INDEX, 1, true) then
+ return true
+ end
+ return false
+end
+
function m.isGlobalID(id)
return ssub(id, 1, 2) == 'g:'
or ssub(id, 1, 3) == 'dn:'
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 13e0f621..973c57a9 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -43,6 +43,7 @@ local eachSource = noder.eachSource
local compileAllNodes = noder.compileAllNodes
local compilePartNoders = noder.compilePartNodes
local isGlobalID = noder.isGlobalID
+local hasCall = noder.hasCall
local SPLIT_CHAR = noder.SPLIT_CHAR
local RETURN_INDEX = noder.RETURN_INDEX
@@ -799,7 +800,8 @@ function m.searchRefsByID(status, suri, expect, mode)
if mode == 'def'
or mode == 'alldef'
or ignoredIDs[id]
- or id == 'dn:string' then
+ or id == 'dn:string'
+ or hasCall(field) then
for _, guri in ceach('def:' .. id) do
if uri == guri then
goto CONTINUE