diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 14:39:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 14:39:57 +0800 |
commit | 06fa4b4a005464ad301a54bdf52e6d122821cb40 (patch) | |
tree | 85e22952f904a5f6c00698c3d8f22506fdf94d05 /script | |
parent | 721fb0e63eee0d80361107671e44c46cff364a1d (diff) | |
download | lua-language-server-06fa4b4a005464ad301a54bdf52e6d122821cb40.zip |
improve performance
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/guide.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index eed2674f..3e2fb69b 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2141,6 +2141,9 @@ function m.checkReturnMark(status, a, mark) end function m.searchSameFieldsInValue(status, ref, start, pushQueue, mode) + if status.share.inBeSetValue and status.share.inBeSetValue > 0 then + return + end local value = m.getObjectValue(ref) if not value then return @@ -2241,11 +2244,13 @@ function m.checkSameSimpleAsSetValue(status, ref, start, pushQueue) if not obj then return end + status.share.inBeSetValue = (status.share.inBeSetValue or 0) + 1 local newStatus = m.status(status) m.searchRefs(newStatus, obj, 'ref') for _, res in ipairs(newStatus.results) do pushQueue(res, start, true) end + status.share.inBeSetValue = (status.share.inBeSetValue or 0) - 1 end local function getTableAndIndexIfIsForPairsKeyOrValue(ref) @@ -2333,6 +2338,9 @@ function m.checkSameSimpleInString(status, ref, start, pushQueue, mode) and not hasTypeName(ref, 'string') then return end + if status.depth > 5 then + return + end if not status.interface.docType then return end @@ -2904,7 +2912,7 @@ function m.searchRefs(status, obj, mode) tracy.ZoneEnd() -- 检查simple tracy.ZoneBeginN('searchRefs searchSameFields') - if status.depth <= 10 then + if status.depth <= 20 then local simple = m.getSimple(obj) if simple then m.searchSameFields(status, simple, mode) @@ -4379,4 +4387,8 @@ function m.requestInfer(obj, interface, deep) return status.results, status.share.count end +function m.debugView(obj) + return require 'files'.position(m.getUri(obj), obj.start) +end + return m |