Skip to content

Commit a6b283c

Browse files
committed
fix review comments
1 parent 50b4d5a commit a6b283c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/extension/prompt/common/codeGuesser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const enum GuessedLineType {
1919
NaturalLanguage
2020
}
2121

22+
const commonCppDirectives = ['# include', '# define', '# ifdef', '# ifndef', '# endif', '# pragma', '# if', '# else', '# elif', '# undef', '# error', '# line', '# warning'];
23+
24+
2225
function guessLineType(line: string): GuessedLineType {
2326
if (line.length === 0) {
2427
return GuessedLineType.Unknown;
@@ -37,10 +40,9 @@ function guessLineType(line: string): GuessedLineType {
3740
return GuessedLineType.Code;
3841
}
3942

40-
// If the line starts with a '#' followed by a space, it's possibly markdown header
43+
// If the line starts with '#'s followed by a space, it's possibly markdown header
4144
// A popular exception is if the line contains C/C++ preprocessor directives
4245
if (line.match(/^#+ .+$/)) {
43-
const commonCppDirectives = ['# include', '# define', '# ifdef', '# ifndef', '# endif', '# pragma', '# if', '# else', '# elif', '# undef', '# error', '# line', '# warning'];
4446
// If line does not contain any # directives used in C, C++.
4547
if (!commonCppDirectives.some(directive => line.trim().startsWith(directive))) {
4648
return GuessedLineType.NaturalLanguage;

0 commit comments

Comments
 (0)