From 275fc299452cd22943fa953176862a2a48439ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Thu, 7 Nov 2019 16:04:20 -0500 Subject: [PATCH] Do not discard completions that contain textEdit --- spyder/plugins/editor/widgets/codeeditor.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py index 149a85dd657..2b85ae81dc0 100644 --- a/spyder/plugins/editor/widgets/codeeditor.py +++ b/spyder/plugins/editor/widgets/codeeditor.py @@ -1069,9 +1069,17 @@ def process_completion(self, params): position, automatic = args try: completions = params['params'] - completions = ([] if completions is None else - [completion for completion in completions - if completion['insertText']]) + if completions is None: + completions = [] + else: + actual_completions = [] + for completion in completions: + insert_text_valid = ('insertText' in completion and + completion['insertText']) + text_edit_valid = 'textEdit' in completion + if insert_text_valid or text_edit_valid: + actual_completions.append(completion) + completions = actual_completions replace_end = self.textCursor().position() under_cursor = self.get_current_word_and_position(completion=True)