From 0d0d904f3edc96d8ef5fb7334705cad49bf5f832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Wed, 14 Jul 2021 12:05:04 +0100 Subject: [PATCH] Performance: do not call `get_signatures()` if snippets are disabled This is a key change that should have been included in #26 but was left out by omission when porting the changes from my fork. --- pylsp/plugins/jedi_completion.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pylsp/plugins/jedi_completion.py b/pylsp/plugins/jedi_completion.py index 52017944..1ac33c30 100644 --- a/pylsp/plugins/jedi_completion.py +++ b/pylsp/plugins/jedi_completion.py @@ -184,8 +184,11 @@ def _format_completion(d, include_params=True, resolve=False, resolve_label=Fals path = path.replace('/', '\\/') completion['insertText'] = path - sig = d.get_signatures() - if (include_params and sig and not is_exception_class(d.name)): + if include_params and not is_exception_class(d.name): + sig = d.get_signatures() + if not sig: + return completion + positional_args = [param for param in sig[0].params if '=' not in param.description and param.name not in {'/', '*'}]