mathworks / mathworks/MATLAB-extension-for-vscode

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

Open
#338 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
435
Forks
40
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MATLAB: Run Current Section command and its breakpoint handling, then compare its behavior with the regular Run action. Reproduce the issue using the provided .m script and breakpoint at line 5; done means running the current section enters debugging mode and pauses at that breakpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.