@@ -2199,6 +2199,38 @@ local function bindDocWithSources(sources, binded)
21992199 end
22002200end
22012201
2202+ local docsDedupe = function (sources )
2203+ local removeByValue = function (bindDocs , value )
2204+ for i = # bindDocs , 1 , - 1 do
2205+ if bindDocs [i ] == value then
2206+ table.remove (bindDocs , i )
2207+ break
2208+ end
2209+ end
2210+ end
2211+ for _ , source in ipairs (sources ) do
2212+ if source .bindDocs then
2213+ local docs = {}
2214+ for i = # source .bindDocs , 1 , - 1 do
2215+ local doc = source .bindDocs [i ]
2216+ if doc .type == ' doc.param' and doc .param [1 ] then
2217+ local param1 = doc .param [1 ]
2218+ if docs [param1 ] then
2219+ local old = docs [param1 ]
2220+ if old .virtual and not doc .virtual then
2221+ removeByValue (source .bindDocs , old )
2222+ elseif not old .virtual and doc .virtual then
2223+ removeByValue (source .bindDocs , doc )
2224+ doc = old
2225+ end
2226+ end
2227+ docs [param1 ] = doc
2228+ end
2229+ end
2230+ end
2231+ end
2232+ end
2233+
22022234local bindDocAccept = {
22032235 ' local' , ' setlocal' , ' setglobal' ,
22042236 ' setfield' , ' setmethod' , ' setindex' ,
@@ -2253,6 +2285,7 @@ local function bindDocs(state)
22532285 end
22542286 end
22552287 end
2288+ docsDedupe (sources )
22562289end
22572290
22582291local function findTouch (state , doc )
0 commit comments