Skip to content

Commit c2270dc

Browse files
committed
check isComment first
1 parent 533f1ea commit c2270dc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/issues/issueTodoProvider.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import { MAX_LINE_LENGTH } from './util';
7+
import { isComment, MAX_LINE_LENGTH } from './util';
88
import { CODING_AGENT, CREATE_ISSUE_TRIGGERS, ISSUES_SETTINGS_NAMESPACE, SHOW_CODE_LENS } from '../common/settingKeys';
99
import { escapeRegExp } from '../common/utils';
1010
import { CopilotRemoteAgentManager } from '../github/copilotRemoteAgent';
@@ -114,7 +114,11 @@ export class IssueTodoProvider implements vscode.CodeActionProvider, vscode.Code
114114

115115
const codeLenses: vscode.CodeLens[] = [];
116116
for (let lineNumber = 0; lineNumber < document.lineCount; lineNumber++) {
117-
const line = document.lineAt(lineNumber).text;
117+
const textLine = document.lineAt(lineNumber);
118+
const { text: line, firstNonWhitespaceCharacterIndex } = textLine;
119+
if (!(await isComment(document, new vscode.Position(lineNumber, firstNonWhitespaceCharacterIndex)))) {
120+
continue;
121+
}
118122
const todoInfo = this.findTodoInLine(line);
119123
if (todoInfo) {
120124
const { match, search, insertIndex } = todoInfo;

0 commit comments

Comments
 (0)