diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-23 17:05:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-23 17:05:15 +0800 |
commit | db2b91b69613f682031459721e2c6f5d710571a6 (patch) | |
tree | 7fcc659f651d57db8d6d4d5c5bd4e706e2e3a205 | |
parent | 71a394c07bf51a2c479e43fd9421c276f7ec4450 (diff) | |
download | lua-language-server-db2b91b69613f682031459721e2c6f5d710571a6.zip |
允许doc绑定多个source
-rw-r--r-- | script-beta/parser/guide.lua | 12 | ||||
-rw-r--r-- | script-beta/parser/luadoc.lua | 8 |
2 files changed, 12 insertions, 8 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index c14dbb77..6f68280f 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1426,11 +1426,13 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode) local newStatus = m.status(status) newStatus.cache.searchingBindedDoc = true for _, res in ipairs(results) do - local source = m.getDocState(res) - local ref = source.bind - if not mark[ref] then - mark[ref] = true - m.searchRefs(newStatus, ref, mode) + local doc = m.getDocState(res) + local refs = doc.bindSources + for _, ref in ipairs(refs) do + if not mark[ref] then + mark[ref] = true + m.searchRefs(newStatus, ref, mode) + end end end for _, res in ipairs(newStatus.results) do diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua index 469c086f..88521a8b 100644 --- a/script-beta/parser/luadoc.lua +++ b/script-beta/parser/luadoc.lua @@ -692,6 +692,10 @@ local function bindDoc(state, lns, binded) -- 空行 return end + local bindSources = {} + for _, doc in ipairs(binded) do + doc.bindSources = bindSources + end guide.eachSourceBetween(state.ast, start, finish, function (src) if src.type == 'local' or src.type == 'setlocal' @@ -703,9 +707,7 @@ local function bindDoc(state, lns, binded) or src.type == 'tableindex' or src.type == 'function' then src.bindDocs = binded - for _, doc in ipairs(binded) do - doc.bind = src - end + bindSources[#bindSources+1] = src end end) end |