Skip to content

Commit 9a03628

Browse files
authored
fix: do not invoke debug traps during completion funcs (#163)
1 parent 87e61ae commit 9a03628

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
},
1212
"rust-analyzer.check.command": "clippy",
1313
"rewrap.wrappingColumn": 90,
14-
"rust-analyzer.cargo.features": "all"
14+
"rust-analyzer.cargo.features": "all",
15+
"rust-analyzer.debug.openDebugPane": true
1516
}

brush-core/src/completion.rs

+6
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,14 @@ impl Spec {
506506
args.push(preceding_token);
507507
}
508508

509+
// TODO: Find a more appropriate interlock here. For now we use the existing
510+
// handler depth count to suppress any debug traps.
511+
shell.traps.handler_depth += 1;
512+
509513
let result = shell.invoke_function(function_name, &args).await?;
510514

515+
shell.traps.handler_depth -= 1;
516+
511517
tracing::debug!("[called completion func '{function_name}' => {result}]");
512518

513519
// When the function returns the special value 124, then it's a request

0 commit comments

Comments
 (0)