Skip to content

"MATLAB:Run Current Section" does not stop at breakpoint #338

Description

@cuixing158

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);
  1. add a breakpoint at line 5.

  2. place the mouse cursor on line 5.

  3. 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

Screenshots
Image

Useful Information

  • MATLAB Version: R2026a
  • OS Version: win10 22H2
  • VS Code Version: Version: 1.125.1 (system setup)
    Commit: fcf604774b9f2674b473065736ee75077e256353
    Date: 2026-06-19T08:39:34Z
    Electron: 42.2.0
    ElectronBuildId: 14159160
    Chromium: 148.0.7778.97
    Node.js: 24.15.0
    V8: 14.8.178.14-electron.0
    OS: Windows_NT x64 10.0.19045

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions