MATLAB-extension-for-vscode icon indicating copy to clipboard operation
MATLAB-extension-for-vscode copied to clipboard

Doesn't support codeAnalyzerConfiguration.json

Open michellehirsch opened this issue 5 months ago • 1 comments

Describe the bug The VS Code extension doesn't seem to honor custom codeAnalyzerConfiguration.json.

Maybe this is user error, but I think I've done everything right.

In this screenshot, you can see: a) VS Code editor shows a single issue. This is one that comes out of the box b) the Terminal is showing the output of codeIssues on this folder. It shows 4 issues - adding 3 from the configuration

Image

To Reproduce I've attached a sample repo. It has a single MATLAB code file and resources\codeAnalyzerConfiguration.json: customCodeIssuesVSCode.zip

  1. Unzip attachment, open folder in VS Code
  2. cd into resources, run matlab.codeanalysis.validateConfigurationSteps to verify codeAnalyzerConfiguration.json is configured correctly
  3. cd back to root, run matlab.codeanalysis.refreshConfiguration to ensure the configuration is applied
  4. Run c=codeIssues;c.Table to see the list of issues. You should see four
  5. Look in the editor. Should see four issues, but you will only see 1 (if get the same result as me)

Expected behavior I expect this to behave the same as desktop MATLAB editor, which I have verified shows the issues. This screenshot is from the same session of MATLAB (launched from VS Code with desktop)

Image

Useful Information

  • MATLAB Version: 25.1 (R2025a, Update 1)
  • OS Version: macOS 15.6.1
  • VS Code Version: 1.102.2

michellehirsch avatar Aug 29 '25 13:08 michellehirsch

This appears to be the case because checkcode is not returning the diagnostics which are stemming from this configuration. It is possible to get these diagnostics by using the -config option in checkcode, as below:

checkcode('thisIsMyVeryShortFunctionWithAVeryLongName.m', '-config=./resources/codeAnalyzerConfiguration.json')

However, this requires knowledge of these configuration files existing. Alternatively, we may need to change the linting implementation to leverage codeIssues instead of checkcode for R2022b and later.

dklilley avatar Aug 29 '25 13:08 dklilley