@@ -541,6 +541,40 @@ final class AcceptSuggestionTests: XCTestCase {
541541
542542 """ )
543543 }
544+
545+ func test_remove_the_first_adjacent_placeholder_in_the_last_line(
546+ ) async throws {
547+ let content = """
548+ apiKeyName: <#T##value: BinaryInteger##BinaryInteger#> <#Hello#>,
549+ """
550+
551+ let suggestion = CodeSuggestion (
552+ text: " apiKeyName: azureOpenAIAPIKeyName " ,
553+ position: . init( line: 0 , character: 12 ) ,
554+ uuid: " " ,
555+ range: . init(
556+ start: . init( line: 0 , character: 0 ) ,
557+ end: . init( line: 0 , character: 12 )
558+ ) ,
559+ displayText: " "
560+ )
561+
562+ var lines = content. breakIntoEditorStyleLines ( )
563+ var extraInfo = SuggestionInjector . ExtraInfo ( )
564+ var cursor = CursorPosition ( line: 5 , character: 34 )
565+ SuggestionInjector ( ) . acceptSuggestion (
566+ intoContentWithoutSuggestion: & lines,
567+ cursorPosition: & cursor,
568+ completion: suggestion,
569+ extraInfo: & extraInfo
570+ )
571+
572+ XCTAssertEqual ( cursor, . init( line: 0 , character: 33 ) )
573+ XCTAssertEqual ( lines. joined ( separator: " " ) , """
574+ apiKeyName: azureOpenAIAPIKeyName <#Hello#>,
575+
576+ """ )
577+ }
544578}
545579
546580extension String {
0 commit comments