@@ -938,12 +938,12 @@ def insert_completion(self, completion, completion_position):
938
938
end = self .get_position_line_number (end_line , end_col )
939
939
cursor .setPosition (start )
940
940
cursor .setPosition (end , QTextCursor .KeepAnchor )
941
- text = to_text_string (completion ['textEdit' ]['newText' ])
941
+ text = str (completion ['textEdit' ]['newText' ])
942
942
else :
943
943
text = completion
944
944
if isinstance (completion , dict ):
945
945
text = completion ['insertText' ]
946
- text = to_text_string (text )
946
+ text = str (text )
947
947
948
948
# Get word to the left of the cursor.
949
949
result = self .get_current_word_and_position (
@@ -953,13 +953,12 @@ def insert_completion(self, completion, completion_position):
953
953
end_position = start_position + len (current_text )
954
954
955
955
# Check if the completion position is in the expected range
956
- if not start_position <= completion_position <= end_position :
956
+ if not ( start_position <= completion_position <= end_position ) :
957
957
return
958
958
cursor .setPosition (start_position )
959
959
960
960
# Remove the word under the cursor
961
- cursor .setPosition (end_position ,
962
- QTextCursor .KeepAnchor )
961
+ cursor .setPosition (end_position , QTextCursor .KeepAnchor )
963
962
else :
964
963
# Check if we are in the correct position
965
964
if cursor .position () != completion_position :
0 commit comments