Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Enable showing calltip widget even with signatures without parameters (Editor/Completion) #22308

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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