mathworks / mathworks/MATLAB-extension-for-vscode

Incorrect auto-commenting of line continuation when % present in cell array.

Open
#178 0 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 breaking long lines using a ... continuation, if the preceding line contains a %, the continued line is automatically commented.

To Reproduce
Steps to reproduce the behavior:

  1. Enter a line containing a % character, such as an fprintf() call.
% The datetime call is obviously wrapped up in a function, but for reproducibility, it's dumped out here.
fprintf('%s  |  Test.\n', char(datetime('now', 'TimeZone', 'local', 'Format', 'yyyy-MM-dd''T''HH:mm:ss.SSSXXX')));
  1. Attempt a line continuation after the % character.
fprintf('%s  |  Test.\n', ...
% char(datetime('now', 'TimeZone', 'local', 'Format', 'yyyy-MM-dd''T''HH:mm:ss.SSSXXX')));

Expected behavior
The continued line should not be automatically commented.

Screenshots
vscode_matlab_continuation_issue

Useful Information

  • OS Version: Microsoft Windows 11 Enterprise (10.0.22631)
  • VS Code Version: 1.87.0
  • MATLAB extension for Visual Studio Code Version: 1.2.0

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

Reproduce the issue in VS Code with the MATLAB extension using the provided fprintf() example and line continuation. Start by tracing the extension behavior that automatically comments continued lines, then verify that a continuation after a % inside the example is not commented. Done means the reported reproduction no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.