File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Tool/Sources/WorkspaceSuggestionService Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public extension Filespace {
5757 return false
5858 }
5959
60- let editingLine = lines [ cursorPosition. line] . dropLast ( 1 ) // dropping \n
60+ let editingLine = lines [ cursorPosition. line] . dropLast ( 1 ) // dropping line ending
6161 let suggestionLines = presentingSuggestion. text. split ( whereSeparator: \. isNewline)
6262 let suggestionFirstLine = suggestionLines. first ?? " "
6363
@@ -102,6 +102,16 @@ public extension Filespace {
102102
103103 return " "
104104 } ( )
105+
106+ /// if the line will not change after accepting the suggestion
107+ if presentingSuggestion. range. isOneLine {
108+ #warning("TODO: Also handle the case where the suggestion doesn't start at character 0")
109+ if editingLine == suggestionFirstLine {
110+ reset ( )
111+ resetSnapshot ( )
112+ return false
113+ }
114+ }
105115
106116 // the line content doesn't match the suggestion
107117 if cursorPosition. character > 0 ,
You can’t perform that action at this time.
0 commit comments