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
215 stars 13 forks source link

`edit()` and opens files in MATLAB editor #125

Open Titas22 opened 3 months ago

Titas22 commented 3 months ago

Using edit() or open() opens files in MATLAB editor instead of VSCode

Example:

edit whos
philipb314 commented 3 months ago

Thanks for the feedback! This is definitely something we will consider supporting in a future release.

Titas22 commented 3 months ago

One (almost) workaround for this is to create a custom mfile.m function in C:\Program Files\MATLAB\MATLAB_VERSION\toolbox\matlab\codetools\+matlab\+codetools\+internal\+edit\:

function mfile(file, ~)
    if exist(file , 'file')
        system(['code "', which(file), '"']);
    end
end

It opens the .m files in VSCode when called from MATLAB editor, however in VSCode it throws an error as reported in #126