mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
234 stars 15 forks source link

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

Open dklilley opened 11 months ago

dklilley commented 11 months ago

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
  2. The classdef should have a warning diagnostic "squiggle"
  3. Hover on the diagnostic, click "Quick Fix...", and select "Suppress message ALIGN on this line"
  4. 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