This extension adds language support for MATLAB to Visual Studio Code.
Like this extension and would like to help me?
Know some code? Contribute, head up to the issues and start killing those pesky bugs.
Don't know how to code? No issues, you can buy me a beer, or a coffee 😄.
Prefer to send something physical? http://amzn.eu/bPCnc5f
(imported from Textmate's syntax)
(Translated from TextMate's snippets)
Uses mlint for checking the MATLAB code for problems on save.
- Open the command palette using
Ctrl+Shift+P
- Type
ext install Matlab
in the command palette
- On the bottom-right corner, click on the select language mode button, if you have created a new file it should display Plain Text
- Select MATLAB in the list of languages.
Alternatively, saving the file with a .m
extension, will allow VS Code to understand that it is a MATLAB file, and automatically select the language correctly.
- Bring-up the autocomplete menu by hitting the
Ctrl+Shift
key combination - Select the snippet that you want to use in the list
- Use
tab
to navigate trough the snippet's variables
-
Open the User Settings by going to File>Preferences>User Settings
-
On the right pane, where you have the settings.json file open, add to the json file.
"matlab.mlintpath" : "path to your mlint.exe file"
For example, on a PC :
"matlab.mlintpath": "C:\\Program Files (x86)\\MATLAB\\R2012a\\bin\\win32\\mlint.exe"
And on a Mac :
"matlab.mlintpath": "/Applications/MATLAB_R2016a.app/bin/maci64/mlint"
-
Save your settings.json file
-
Now, when you open a Matlab document (.m), VS Code displays warnings and errors.
Remark: If you don't want the lint on save option and you want to remove the error message being displayed when the extension activates, change the
matlab.lintOnSave
option in the settings file toFalse
.
For some languages, like Chinese, the return of the linter is not using the default utf-8 encoding, but a different encoding (gb2312 for Chinese). If the linting doesn't show correctly, change the matlab.linterEncoding
to the encoding used by your Windows console. For example, if your Windows is installed in Chinese, add "matlab.linterEncoding" : "gb2312"
to your settings.json.
Visual Studio Code's default file association for .m
files is Objective-C, if you want to setup the default file associationt to be Matlab go to the Users preference (File>Preferences>User Settings) and add the following line:
"files.associations": {"*.m": "matlab"}