@@ -963,22 +963,37 @@ def insert_completion(self, completion, completion_position):
963
963
if current_text == '.' :
964
964
is_auto_completion_character = True
965
965
else :
966
- if current_text in self .auto_completion_characters :
966
+ if (
967
+ kind != CompletionItemKind .FILE and
968
+ current_text in self .auto_completion_characters
969
+ ):
967
970
is_auto_completion_character = True
968
971
969
972
# Adjustments for file completions
970
973
if kind == CompletionItemKind .FILE :
971
- # This is necessary to inseert file completions when
972
- # requesting them next to a colon
973
974
if current_text in ['"' , "'" ]:
975
+ # This is necessary to insert file completions when
976
+ # requesting them next to a colon
974
977
current_text = ''
975
978
start_position += 1
976
-
977
- # And this insert completions for files or directories that
978
- # start with a dot
979
- if current_text in ['".' , "'." ]:
979
+ elif current_text in ['".' , "'." ]:
980
+ # This inserts completions for files or directories
981
+ # that start with a dot
980
982
current_text = '.'
981
983
start_position += 1
984
+ elif current_text == '.' :
985
+ # This is needed if users are asking for file
986
+ # completions to the right of a dot
987
+ cursor_1 = self .textCursor ()
988
+ cursor_1 .movePosition (
989
+ QTextCursor .PreviousCharacter ,
990
+ QTextCursor .MoveAnchor ,
991
+ 2
992
+ )
993
+ cursor_1 .select (QTextCursor .WordUnderCursor )
994
+ current_text = str (cursor_1 .selectedText ())
995
+ start_position = cursor_1 .selectionStart ()
996
+ end_position = start_position + len (current_text ) + 1
982
997
983
998
if not is_auto_completion_character :
984
999
# Check if the completion position is in the expected range
0 commit comments