@@ -37,7 +37,7 @@ import {
37
37
import { isOnlyPunctuationAndWhitespace } from "./filter.js" ;
38
38
import { AutocompleteLanguageInfo } from "./languages.js" ;
39
39
import {
40
- avoidPathLine ,
40
+ avoidPathLineAndEmptyComments ,
41
41
noTopLevelKeywordsMidline ,
42
42
skipPrefixes ,
43
43
stopAtLines ,
@@ -478,9 +478,9 @@ export class CompletionProvider {
478
478
const lines = fullPrefix . split ( "\n" ) ;
479
479
fullPrefix = `${ lines . slice ( 0 , - 1 ) . join ( "\n" ) } \n${
480
480
lang . singleLineComment
481
- } ${ input . injectDetails . split ( "\n" ) . join ( `\n ${ lang . singleLineComment } ` ) } \n ${
482
- lines [ lines . length - 1 ]
483
- } `;
481
+ } ${ input . injectDetails
482
+ . split ( "\n" )
483
+ . join ( `\n ${ lang . singleLineComment } ` ) } \n ${ lines [ lines . length - 1 ] } `;
484
484
}
485
485
486
486
const fullSuffix = getRangeInString ( fileContents , {
@@ -581,7 +581,10 @@ export class CompletionProvider {
581
581
prefix = `${ formattedSnippets } \n\n${ prefix } ` ;
582
582
} else if ( prefix . trim ( ) . length === 0 && suffix . trim ( ) . length === 0 ) {
583
583
// If it's an empty file, include the file name as a comment
584
- prefix = `${ lang . singleLineComment } ${ getLastNPathParts ( filepath , 2 ) } \n${ prefix } ` ;
584
+ prefix = `${ lang . singleLineComment } ${ getLastNPathParts (
585
+ filepath ,
586
+ 2 ,
587
+ ) } \n${ prefix } `;
585
588
}
586
589
587
590
prompt = compiledTemplate ( {
@@ -689,7 +692,10 @@ export class CompletionProvider {
689
692
let lineGenerator = streamLines ( charGenerator ) ;
690
693
lineGenerator = stopAtLines ( lineGenerator , fullStop ) ;
691
694
lineGenerator = stopAtRepeatingLines ( lineGenerator , fullStop ) ;
692
- lineGenerator = avoidPathLine ( lineGenerator , lang . singleLineComment ) ;
695
+ lineGenerator = avoidPathLineAndEmptyComments (
696
+ lineGenerator ,
697
+ lang . singleLineComment ,
698
+ ) ;
693
699
lineGenerator = skipPrefixes ( lineGenerator ) ;
694
700
lineGenerator = noTopLevelKeywordsMidline (
695
701
lineGenerator ,
0 commit comments