You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"MATLAB:Run Current Section" does not stop at breakpoint #338
Describe the bug
when I only care about a specific section (lines starting with double %). When I want the debugger to pause at a certain line of code in that section, provided I’ve already set a breakpoint there, if I run the section using “MATLAB: Run Current Section”, the code executes the entire section directly and ignores the breakpoint!
To Reproduce
Steps to reproduce the behavior:
Create a new script .m file and insert the following code.
a =1;
b =2;
%%section debug,can't stop at line 5
c =a+b; % line 5, have breakpoint
fprintf('c = %d\n', c);
add a breakpoint at line 5.
place the mouse cursor on line 5.
press the F1 shortcut and select “MATLAB: Run Current Section”, or press Ctrl+Enter to run the current section.
The breakpoint does not pause at line 5; instead, the code runs straight through as if you had pressed Run.
Expected behavior
The code enters debugging mode and pauses at line 5
Activity
dklilley commentedon Jun 23, 2026
Hi @cuixing158 , thanks for reaching out about this issue!
I have two clarifying questions:
Is the breakpoint also skipped if you run the entire file (rather than just the section)?
Is the breakpoint hit if you first select "Start Debugging" from VS Code's "Run" menu before running the section?
cuixing158 commentedon Jun 23, 2026
For question 1:
When I run the entire file ,it can hit breakpoint
Question 2:
When I first select "start debug",only as I don't select“MATLAB:Run Current section ",it can hit breakpoint
dklilley commentedon Jun 23, 2026
Thanks for the clarification! I am able to reproduce this on my end as well.
philipb314 commentedon Jun 30, 2026
Thanks for reporting this issue. This is something that we can reproduce and will look into resolving in a future release of the extension. Thanks!