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

Getting error "Cannot open or read Code Analyzer settings from file ... " using a non-existent path #87

Closed anakinsleftleg closed 8 months ago

anakinsleftleg commented 8 months ago

Describe the bug In VSCode Version: 1.85.2, I get the error:

Cannot open or read the Code Analyzer settings from file 'C:\Users\anakin\AppData\Roaming\MathWorks\MATLAB\R2022b\MLintDefaultSettings.txt'. Using default settings instead.

But I don't have R2022b installed and never have on this computer. I thought maybe it had to do with copying VSCode settings over from a previous computer, but in the settings.json there is no field with that value. I uninstalled the Matlab extension, close VSCode, opened it again, reinstalled it. Still get the same error when opening an m-file. The beginning of the file has a red squiggle with that error message. The full error is:

[{
    "resource": "/c:/Users/anakin/Documents/Projects/Software/FFOVMTF/displayPlaneFit.m",
    "owner": "_generated_diagnostic_collection_name_#4",
    "code": "CFERR",
    "severity": 8,
    "message": "Cannot open or read the Code Analyzer settings from file 'C:\\Users\\anakin\\AppData\\Roaming\\MathWorks\\MATLAB\\R2022b\\MLintDefaultSettings.txt'. Using default settings instead.",
    "source": "MATLAB",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 2
}]

After uninstalling the matlab extension, I made sure to clear out any settings in the json file. So I have no idea where that path is coming from or how to clear it or reset it. And I'm definitely not going to nuke my VSCode setup.

To Reproduce I don't know how to reproduce it on another computer. It's simply having the matlab extension installed and opening an m-file.

Expected behavior No error and proper code analyzing

Useful Information

dklilley commented 8 months ago

Thanks for reporting this - I haven't seen this before.

Can you check the following:

  1. Can you verify that the value of the installPath setting points to the correct MATLAB installation?
  2. It's possible that something with the MATLAB preferences has been corrupted. Can you try regenerating the MATLAB preferences to see if that resolves the issue?
anakinsleftleg commented 8 months ago

Very strange. I was sure it was correct, but when I put the output of matlabroot directly into the path field, it worked. No longer giving that error and now it actually connects instead of never connects.

Maybe i had originally given it one directory too much into the path.

Thank you for having me check this