File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 359359--- @return number
360360local function calcFunctionMatchScore (uri , args , func )
361361 if vm .isVarargFunctionWithOverloads (func )
362+ or vm .isFunctionWithOnlyOverloads (func )
362363 or not isAllParamMatched (uri , args , func .args )
363364 then
364365 return - 1
@@ -490,6 +491,36 @@ function vm.isVarargFunctionWithOverloads(func)
490491 return false
491492end
492493
494+ --- @param func table
495+ --- @return boolean
496+ function vm .isFunctionWithOnlyOverloads (func )
497+ if func .type ~= ' function' then
498+ return false
499+ end
500+ if func ._onlyOverloadFunction ~= nil then
501+ return func ._onlyOverloadFunction
502+ end
503+
504+ if not func .bindDocs then
505+ func ._onlyOverloadFunction = false
506+ return false
507+ end
508+ local hasOverload = false
509+ for _ , doc in ipairs (func .bindDocs ) do
510+ if doc .type == ' doc.overload' then
511+ hasOverload = true
512+ elseif doc .type == ' doc.param'
513+ or doc .type == ' doc.return'
514+ then
515+ -- has specified @param or @return, thus not only @overload
516+ func ._onlyOverloadFunction = false
517+ return false
518+ end
519+ end
520+ func ._onlyOverloadFunction = hasOverload
521+ return true
522+ end
523+
493524--- @param func parser.object
494525--- @return boolean
495526function vm .isEmptyFunction (func )
You can’t perform that action at this time.
0 commit comments