• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Gimly/vscode-matlab: MATLAB support for Visual Studio Code

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Gimly/vscode-matlab

开源软件地址(OpenSource Url):

https://github.com/Gimly/vscode-matlab

开源编程语言(OpenSource Language):

TypeScript 100.0%

开源软件介绍(OpenSource Introduction):

MATLAB for Visual Studio Code

This extension adds language support for MATLAB to Visual Studio Code.

Marketplace Installs GitHub issues GitHub pull requests License

Main features

Colorization

syntax

(imported from MathWorks TextMate grammar)

Snippets

snippets

(Translated from TextMate's snippets)

Code Checking

Uses mlint for checking the MATLAB code for problems on save. snippets

Usage

Install the extension in VS Code

  • Open the command palette using Ctrl+Shift+P
  • Type ext install Matlab in the command palette

Select MATLAB as a language

  • 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.

Using snippets

  • 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 through the snippet's variables

Setting-up linter

  • 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 to False.

Setting the linter configuration

By adding "matlab.linterConfig" : "path-to-linter-config-file" to your VSCode configuration file, you can pass a configuration file to the mlint call. Check Matlab's documentation to create this configuration file.

Setting the linter encoding

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.

Changing the default file association

Visual Studio Code's default file association for .m files is Objective-C, if you want to set up the default file association to be Matlab go to the Users preference (File>Preferences>User Settings) and add the following line:

"files.associations": {"*.m": "matlab"}

Changing the default file encoding

MATLAB default file encoding is not utf-8, but Visual Studio Code is using utf-8 as default. The following setting specifies the default encoding for MATLAB files in Visual Studio Code:

"[matlab]": { "files.encoding": "windows1252" }



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap