(self, completion, completion_position)
Insert a completion into the editor.

        completion_position is where the completion was generated.

        The replacement range is computed using the (LSP) completion's
        textEdit field if it exists. Otherwise, we replace from the
        start of the word under the cursor.
Insert a completion into the editor.
Insert a completion into the editor .
def insert_completion(self, completion, completion_position):
        """Insert a completion into the editor.

        completion_position is where the completion was generated.

        The replacement range is computed using the (LSP) completion's
        textEdit field if it exists. Otherwise, we replace from the
        start of the word under the cursor.
        """
        if not completion:
            return

        cursor = self.textCursor()

        start = completion['start']
        end = completion['end']
        text = completion['text']

        cursor.setPosition(start)
        cursor.setPosition(end, QTextCursor.KeepAnchor)
        cursor.removeSelectedText()
        cursor.insertText(text)
        self.setTextCursor(cursor)
def insert_completion ( self , completion , completion_position ) : if not completion : return cursor = self . textCursor ( ) start = completion [ 'start' ] end = completion [ 'end' ] text = completion [ 'text' ] cursor . setPosition ( start ) cursor . setPosition ( end , QTextCursor . KeepAnchor ) cursor . removeSelectedText ( ) cursor . insertText ( text ) self . setTextCursor ( cursor )