mathworks / mathworks/MATLAB-extension-for-vscode

Diagnostic suppression for misaligned `classdef...end` places suppression in wrong location

Open
#67 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 the classdef and its matching end are misaligned, attempting to suppress the resulting warning diagnostic causes the diagnostic suppression to be inserted after the end instead of after the classdef.

To Reproduce
Steps to reproduce the behavior:

  1. Type the following into a MATLAB file:
classdef Foo

    end
  1. The classdef should have a warning diagnostic "squiggle"
  2. Hover on the diagnostic, click "Quick Fix...", and select "Suppress message ALIGN on this line"
  3. This result in the following:
classdef Foo

    end %#ok<ALIGN>

Expected behavior
The diagnostic suppression text should be added to the end of the same line the classdef is on.

Useful Information

  • OS Version: Windows 11
  • VS Code Version: 1.83.1
  • MATLAB extension version: 1.1.3

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 misaligned classdef/end example in a MATLAB file and start from the VS Code Quick Fix flow for suppressing the ALIGN diagnostic. Trace where the suppression location is chosen; done when the suppression is placed on the classdef line rather than after end, while the existing Quick Fix behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.