diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-21 14:40:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-21 14:40:27 +0800 |
commit | 9323ee02699e8f12a7ce19df873e69256b3a2678 (patch) | |
tree | a200861ed6aee2413b3f5b52151ce891964ffc45 /server | |
parent | 1c038bc8af402ed05ebc10b78b8274c95ee0b4e1 (diff) | |
download | lua-language-server-9323ee02699e8f12a7ce19df873e69256b3a2678.zip |
优先取call内部的参数
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/find_source.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/core/find_source.lua b/server/src/core/find_source.lua index 65df6b95..4c4c460c 100644 --- a/server/src/core/find_source.lua +++ b/server/src/core/find_source.lua @@ -20,8 +20,19 @@ local function findAtPos(sources, pos, level) return nil end table.sort(res, function (a, b) + if a == b then + return false + end local rangeA = a.finish - a.start local rangeB = b.finish - b.start + -- 特殊处理:func 'str' 的情况下,list与string的范围会完全相同,此时取string + if rangeA == rangeB then + if b.type == 'call' and #b == 1 and b[1] == a then + return true + else + return false + end + end return rangeA < rangeB end) local source = res[level or 1] |