Skip to content

Commit 895f281

Browse files
authored
Merge pull request microsoft#259224 from microsoft/tyriar/258996
Fix /.*/ auto approve case
2 parents 1a8fc5c + 055f165 commit 895f281

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandLineAutoApprover.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ export class CommandLineAutoApprover extends Disposable {
185185
flags = flags.replaceAll('g', '');
186186
}
187187

188+
// Allow .* as users expect this would match everything
189+
if (regexPattern === '.*') {
190+
return new RegExp(regexPattern);
191+
}
192+
188193
try {
189194
const regex = new RegExp(regexPattern, flags || undefined);
190195
if (regExpLeadsToEndlessLoop(regex)) {

src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/commandLineAutoApprover.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ suite('CommandLineAutoApprover', () => {
148148
});
149149

150150
suite('regex patterns', () => {
151+
test('should handle /.*/', () => {
152+
setAutoApprove({
153+
"/.*/": true,
154+
});
155+
156+
ok(isAutoApproved('echo hello'));
157+
});
158+
151159
test('should handle regex patterns in autoApprove', () => {
152160
setAutoApprove({
153161
"/^echo/": true,

0 commit comments

Comments
 (0)