File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
crates/emmylua_ls/src/handlers/completion/providers Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -59,14 +59,20 @@ fn add_resolve_member_infos(
5959 }
6060 }
6161
62- // 所有 DocFunction 只取第一个作为补全项
63- let mut find_doc_function = false ;
62+ // 当`DocFunction`超过5个时只取第一个作为补全项
63+ let doc_function_count = member_infos
64+ . iter ( )
65+ . filter ( |info| matches ! ( info. typ, LuaType :: DocFunction ( _) ) )
66+ . count ( ) ;
67+ let limit_doc_functions = doc_function_count > 5 ;
68+ let mut first_doc_function = false ;
69+
6470 for member_info in member_infos {
65- if matches ! ( member_info. typ, LuaType :: DocFunction ( _) ) {
66- if find_doc_function {
71+ if limit_doc_functions && matches ! ( member_info. typ, LuaType :: DocFunction ( _) ) {
72+ if first_doc_function {
6773 continue ;
6874 }
69- find_doc_function = true ;
75+ first_doc_function = true ;
7076 }
7177
7278 match resolve_state {
You can’t perform that action at this time.
0 commit comments