3737
3838
3939@hookimpl
40- def pylsp_completions (config , document , position , signatures_to_markdown ):
40+ def pylsp_completions (config , document , position ):
4141 """Get formatted completions for current code position"""
4242 settings = config .plugin_settings ("jedi_completion" , document_path = document .path )
4343 resolve_eagerly = settings .get ("eager" , False )
44- code_position = _utils . position_to_jedi_linecolumn ( document , position )
44+ signature_config = config . settings . get ( "signatures" , {} )
4545
46+ code_position = _utils .position_to_jedi_linecolumn (document , position )
4647 code_position ["fuzzy" ] = settings .get ("fuzzy" , False )
4748 completions = document .jedi_script (use_document_path = True ).complete (** code_position )
4849
@@ -89,7 +90,7 @@ def pylsp_completions(config, document, position, signatures_to_markdown):
8990 resolve = resolve_eagerly ,
9091 resolve_label_or_snippet = (i < max_to_resolve ),
9192 snippet_support = snippet_support ,
92- signatures_to_markdown = signatures_to_markdown ,
93+ signature_config = signature_config ,
9394 )
9495 for i , c in enumerate (completions )
9596 ]
@@ -105,7 +106,7 @@ def pylsp_completions(config, document, position, signatures_to_markdown):
105106 resolve = resolve_eagerly ,
106107 resolve_label_or_snippet = (i < max_to_resolve ),
107108 snippet_support = snippet_support ,
108- signatures_to_markdown = signatures_to_markdown ,
109+ signature_config = signature_config ,
109110 )
110111 completion_dict ["kind" ] = lsp .CompletionItemKind .TypeParameter
111112 completion_dict ["label" ] += " object"
@@ -121,7 +122,7 @@ def pylsp_completions(config, document, position, signatures_to_markdown):
121122 resolve = resolve_eagerly ,
122123 resolve_label_or_snippet = (i < max_to_resolve ),
123124 snippet_support = snippet_support ,
124- signatures_to_markdown = signatures_to_markdown ,
125+ signature_config = signature_config ,
125126 )
126127 completion_dict ["kind" ] = lsp .CompletionItemKind .TypeParameter
127128 completion_dict ["label" ] += " object"
@@ -142,7 +143,9 @@ def pylsp_completions(config, document, position, signatures_to_markdown):
142143
143144@hookimpl
144145def pylsp_completion_item_resolve (
145- config , completion_item , document , signatures_to_markdown
146+ config ,
147+ completion_item ,
148+ document ,
146149):
147150 """Resolve formatted completion for given non-resolved completion"""
148151 shared_data = document .shared_data ["LAST_JEDI_COMPLETIONS" ].get (
@@ -162,7 +165,7 @@ def pylsp_completion_item_resolve(
162165 completion ,
163166 data ,
164167 markup_kind = preferred_markup_kind ,
165- signatures_to_markdown = signatures_to_markdown ,
168+ signature_config = config . settings . get ( "signatures" , {}) ,
166169 )
167170 return completion_item
168171
@@ -218,19 +221,14 @@ def use_snippets(document, position):
218221 return expr_type not in _IMPORTS and not (expr_type in _ERRORS and "import" in code )
219222
220223
221- def _resolve_completion (
222- completion ,
223- d ,
224- markup_kind : str ,
225- signatures_to_markdown : Optional [Callable [[List [str ]], str ]] = None ,
226- ):
224+ def _resolve_completion (completion , d , markup_kind : str , signature_config : dict ):
227225 completion ["detail" ] = _detail (d )
228226 try :
229227 docs = _utils .format_docstring (
230228 d .docstring (raw = True ),
231229 signatures = [signature .to_string () for signature in d .get_signatures ()],
232230 markup_kind = markup_kind ,
233- signatures_to_markdown = signatures_to_markdown ,
231+ signature_config = signature_config ,
234232 )
235233 except Exception :
236234 docs = ""
@@ -245,7 +243,7 @@ def _format_completion(
245243 resolve = False ,
246244 resolve_label_or_snippet = False ,
247245 snippet_support = False ,
248- signatures_to_markdown = None ,
246+ signature_config = None ,
249247):
250248 completion = {
251249 "label" : _label (d , resolve_label_or_snippet ),
@@ -256,7 +254,7 @@ def _format_completion(
256254
257255 if resolve :
258256 completion = _resolve_completion (
259- completion , d , markup_kind , signatures_to_markdown
257+ completion , d , markup_kind , signature_config = signature_config
260258 )
261259
262260 # Adjustments for file completions
0 commit comments