@@ -89,6 +89,39 @@ local function makeOneSignature(source, oop, index)
89
89
}
90
90
end
91
91
92
+ local function isEventNotMatch (call , src )
93
+ if not call .args or not src .args then
94
+ return false
95
+ end
96
+ local literal , index
97
+ for i = 1 , 2 do
98
+ if not call .args [i ] then
99
+ break
100
+ end
101
+ literal = guide .getLiteral (call .args [i ])
102
+ if literal then
103
+ index = i
104
+ break
105
+ end
106
+ end
107
+ if not literal then
108
+ return false
109
+ end
110
+ local event = src .args [index ]
111
+ if not event or event .type ~= ' doc.type.arg' then
112
+ return false
113
+ end
114
+ if not event .extends
115
+ or # event .extends .types ~= 1 then
116
+ return false
117
+ end
118
+ local eventLiteral = event .extends .types [1 ] and guide .getLiteral (event .extends .types [1 ])
119
+ if eventLiteral == nil then
120
+ return false
121
+ end
122
+ return eventLiteral ~= literal
123
+ end
124
+
92
125
--- @async
93
126
local function makeSignatures (text , call , pos )
94
127
local func = call .node
@@ -139,7 +172,8 @@ local function makeSignatures(text, call, pos)
139
172
for src in node :eachObject () do
140
173
if (src .type == ' function' and not vm .isVarargFunctionWithOverloads (src ))
141
174
or src .type == ' doc.type.function' then
142
- if not mark [src ] then
175
+ if not mark [src ]
176
+ and not isEventNotMatch (call , src ) then
143
177
mark [src ] = true
144
178
signs [# signs + 1 ] = makeOneSignature (src , oop , index )
145
179
end
@@ -149,7 +183,8 @@ local function makeSignatures(text, call, pos)
149
183
if set .type == ' doc.class' then
150
184
for _ , overload in ipairs (set .calls ) do
151
185
local f = overload .overload
152
- if not mark [f ] then
186
+ if not mark [f ]
187
+ and not isEventNotMatch (call , src ) then
153
188
mark [f ] = true
154
189
signs [# signs + 1 ] = makeOneSignature (f , oop , index )
155
190
end
0 commit comments