Skip to content

Commit

Permalink
Merge pull request #22308 from dalthviz/fixes_issue_21660_p1
Browse files Browse the repository at this point in the history
PR: Enable showing calltip widget even with signatures without parameters (Editor/Completion)
  • Loading branch information
ccordoba12 authored Aug 1, 2024
2 parents 8ebeff9 + 0caecb4 commit 11c7786
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions spyder/plugins/editor/widgets/codeeditor/lsp_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,7 @@ def process_signatures(self, params):
try:
signature_params = params["params"]

if (
signature_params is not None
and "activeParameter" in signature_params
):
if signature_params is not None:
self.sig_signature_invoked.emit(signature_params)
signature_data = signature_params["signatures"]
documentation = signature_data["documentation"]
Expand All @@ -828,12 +825,17 @@ def process_signatures(self, params):
# spaces defined as `\xa0`
documentation = documentation.replace("\xa0", " ")

parameter_idx = signature_params["activeParameter"]
parameters = signature_data["parameters"]
# Enable parsing signature's active parameter if available
# while allowing to show calltip for signatures without
# parameters.
# See spyder-ide/spyder#21660
parameter = None
if len(parameters) > 0 and parameter_idx < len(parameters):
parameter_data = parameters[parameter_idx]
parameter = parameter_data["label"]
if "activeParameter" in signature_params:
parameter_idx = signature_params["activeParameter"]
parameters = signature_data["parameters"]
if len(parameters) > 0 and parameter_idx < len(parameters):
parameter_data = parameters[parameter_idx]
parameter = parameter_data["label"]

signature = signature_data["label"]

Expand Down

0 comments on commit 11c7786

Please sign in to comment.