@@ -54,6 +54,7 @@ def pylsp_completions(config, document, position):
5454
5555 should_include_params = settings .get ('include_params' )
5656 should_include_class_objects = settings .get ('include_class_objects' , True )
57+ should_include_function_objects = settings .get ('include_function_objects' , True )
5758
5859 max_to_resolve = settings .get ('resolve_at_most' , 25 )
5960 modules_to_cache_for = settings .get ('cache_for' , None )
@@ -63,6 +64,7 @@ def pylsp_completions(config, document, position):
6364
6465 include_params = snippet_support and should_include_params and use_snippets (document , position )
6566 include_class_objects = snippet_support and should_include_class_objects and use_snippets (document , position )
67+ include_function_objects = snippet_support and should_include_function_objects and use_snippets (document , position )
6668
6769 ready_completions = [
6870 _format_completion (
@@ -88,6 +90,19 @@ def pylsp_completions(config, document, position):
8890 completion_dict ['label' ] += ' object'
8991 ready_completions .append (completion_dict )
9092
93+ if include_function_objects :
94+ for i , c in enumerate (completions ):
95+ if c .type == 'function' :
96+ completion_dict = _format_completion (
97+ c ,
98+ False ,
99+ resolve = resolve_eagerly ,
100+ resolve_label_or_snippet = (i < max_to_resolve )
101+ )
102+ completion_dict ['kind' ] = lsp .CompletionItemKind .TypeParameter
103+ completion_dict ['label' ] += ' object'
104+ ready_completions .append (completion_dict )
105+
91106 for completion_dict in ready_completions :
92107 completion_dict ['data' ] = {
93108 'doc_uri' : document .uri
0 commit comments