Skip to content

Commit

Permalink
Merge pull request #97 from mathworks/dklilley-release-1.2.0
Browse files Browse the repository at this point in the history
MATLAB extension for VS Code - v1.2.0
  • Loading branch information
dklilley authored Mar 5, 2024
2 parents 9157577 + 95424b5 commit 7b86b5d
Show file tree
Hide file tree
Showing 19 changed files with 1,631 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/semi": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/indent": ["error", 4, {
"SwitchCase": 1,
"VariableDeclarator": 1,
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.0] - 2024-03-05

### Added
- Code execution support

### Fixed
- Fixed linting diagnostic suppression with MATLAB R2024a

## [1.1.6] - 2024-01-16

### Fixed
Expand Down
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# MATLAB extension for Visual Studio Code
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.
This extension provides support for editing and running MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.

You can use this extension with or without MATLAB installed on your system. However, to make use of the advanced code-editing features of the extension, you must have MATLAB R2021a or later installed. For more information, see the [Get Started](#get-started) section.
You can use this extension with or without MATLAB installed on your system. However, to make use of the advanced features of the extension or run MATLAB code, you must have MATLAB R2021a or later installed. For more information, see the [Get Started](#get-started) section.

For an overview of the major features of this extension, you can watch the [Introducing the New MATLAB Extension for Visual Studio Code](https://www.youtube.com/watch?v=kYTBAr9LlGg) video.
For an overview of some of the major features of this extension, you can watch the [Introducing the New MATLAB Extension for Visual Studio Code](https://www.youtube.com/watch?v=kYTBAr9LlGg) video.

## Installation
You can install the extension from within Visual Studio Code or download it from [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab). After installing the extension, you might need to configure it to make full use of all the features. For more information, see the [Configuration](#configuration) section.

## Get Started
To get started using the extension, open any MATLAB code file, or create a new file and set the language to MATLAB.
To get started using the extension, open any MATLAB code file (.m), or create a new file and set the language to MATLAB.

### Basic Features (MATLAB not required)
The extension provides several basic features, regardless of whether you have MATLAB installed on your system. These features include:
Expand All @@ -21,7 +21,8 @@ The extension provides several basic features, regardless of whether you have MA
![MATLAB Extension Demo](public/BasicFeatures.gif)

### Advanced Features (requires MATLAB installed on your system)
If you have MATLAB R2021a or later installed on your system, you have access to an additional set of advanced code-editing features. These features include:
If you have MATLAB R2021a or later installed on your system, you have access to an additional set of advanced features. These features include:
* Code execution
* Automatic code completion
* Source code formatting (document formatting)
* Code navigation
Expand All @@ -30,6 +31,19 @@ If you have MATLAB R2021a or later installed on your system, you have access to

![MATLAB Extension Demo](public/AdvancedFeatures.gif)

## Run MATLAB Code
You can run a MATLAB code file or a selection within a MATLAB code file in Visual Studio Code using the Run button at the top of the file or the `Run File` or `Run Current Selection` commands. When you run the file, output displays in the "Terminal" pane of Visual Studio Code. You also can enter MATLAB code directly in the MATLAB terminal. To stop execution of MATLAB code, press **Ctrl+C**.

![MATLAB Execution Demo](public/CodeExecution.gif)

### Limitations
There are some limitations to running MATLAB code in Visual Studio Code:
* Debugging is not supported.
* The **pause** and **input** functions are not supported.
* Output from timers, callbacks, and DataQueue objects is not shown in the Command Window.
* Creating a custom run configuration for a file is not supported.


## Configuration
To configure the extension, go to the extension settings and select from the available options.

Expand Down Expand Up @@ -74,8 +88,14 @@ We encourage all feedback. If you encounter a technical issue or have an enhance

## Release Notes

### 1.2.0
Release date: 2024-03-05

Added:
* Code execution support

### 1.1.0
Release date: 2023-06-5
Release date: 2023-06-05

Added:
* Document symbol and outline support
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 103 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Edit MATLAB code with syntax highlighting, linting, navigation support, and more",
"icon": "public/L-Membrane_RGB_128x128.png",
"license": "MIT",
"version": "1.1.6",
"version": "1.2.0",
"engines": {
"vscode": "^1.67.0"
},
Expand All @@ -20,16 +20,108 @@
"Snippets"
],
"activationEvents": [
"onLanguage:matlab"
"onLanguage:matlab",
"onTerminalProfile:matlab.terminal-profile"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "matlab.changeMatlabConnection",
"title": "MATLAB: Change MATLAB Connection"
},
{
"command": "matlab.runFile",
"title": "MATLAB: Run File",
"icon": "$(play)"
},
{
"command": "matlab.runSelection",
"title": "MATLAB: Run Current Selection",
"icon": "$(play)"
},
{
"command": "matlab.openCommandWindow",
"title": "MATLAB: Open Command Window",
"icon": "$(output)"
},
{
"command": "matlab.interrupt",
"title": "MATLAB: Interrupt"
},
{
"command": "matlab.addToPath",
"title": "MATLAB: Add Folder To Path"
},
{
"command": "matlab.changeDirectory",
"title": "MATLAB: Change current directory"
}
],
"keybindings": [
{
"command": "matlab.runFile",
"key": "f5",
"when": "editorTextFocus && editorLangId == matlab && !findInputFocussed && !replaceInputFocussed && resourceScheme != 'untitled'"
},
{
"command": "matlab.runSelection",
"key": "shift+enter",
"when": "editorTextFocus && editorHasSelection && !editorHasMultipleSelections && editorLangId == matlab && !findInputFocussed && !replaceInputFocussed"
},
{
"command": "matlab.interrupt",
"key": "Ctrl+C",
"mac": "Cmd+C",
"when": "((editorTextFocus && !editorHasSelection && editorLangId == matlab) || (terminalFocus && matlab.isActiveTerminal && !matlab.terminalHasSelection && !terminalTextSelectedInFocused)) "
}
],
"menus": {
"commandPalette": [
{
"command": "matlab.addToPath",
"when": "false"
},
{
"command": "matlab.changeDirectory",
"when": "false"
}
],
"editor/title/run": [
{
"command": "matlab.runFile",
"when": "editorLangId == matlab && resourceScheme != 'untitled'",
"group": "1_run"
},
{
"command": "matlab.runSelection",
"when": "editorLangId == matlab && editorHasSelection && !editorHasMultipleSelections",
"group": "2_run"
}
],
"editor/context": [
{
"command": "matlab.runFile",
"when": "editorLangId == matlab && resourceScheme != 'untitled'",
"group": "1_run"
},
{
"command": "matlab.runSelection",
"when": "editorLangId == matlab && editorHasSelection && !editorHasMultipleSelections",
"group": "1_run"
}
],
"explorer/context": [
{
"command": "matlab.addToPath",
"when": "explorerResourceIsFolder"
},
{
"command": "matlab.changeDirectory",
"when": "explorerResourceIsFolder"
}
]
},
"configuration": {
"title": "MATLAB",
"properties": {
Expand Down Expand Up @@ -101,7 +193,15 @@
"language": "matlab",
"path": "./snippets/matlab.json"
}
]
],
"terminal": {
"profiles": [
{
"title": "MATLAB",
"id": "matlab.terminal-profile"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run compile && cd server && npm prune --production && cd ..",
Expand Down
Binary file added public/CodeExecution.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/Execution.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/runcode.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions src/Notifications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2023-2024 The MathWorks, Inc.

enum Notification {
// Connection Status Updates
MatlabConnectionClientUpdate = 'matlab/connection/update/client',
MatlabConnectionServerUpdate = 'matlab/connection/update/server',

// Errors
MatlabLaunchFailed = 'matlab/launchfailed',
MatlabFeatureUnavailable = 'feature/needsmatlab',
MatlabFeatureUnavailableNoMatlab = 'feature/needsmatlab/nomatlab',

// Execution
MatlabRequestInstance = 'matlab/request',

MVMEvalRequest = 'evalRequest',
MVMEvalComplete = 'evalRequest',
MVMFevalRequest = 'fevalRequest',
MVMFevalComplete = 'fevalRequest',

MVMText = 'text',
MVMClc = 'clc',

MVMInterruptRequest = 'interruptRequest',

MVMStateChange = 'mvmStateChange',

// Telemetry
LogTelemetryData = 'telemetry/logdata'
}

export default Notification
Loading

0 comments on commit 7b86b5d

Please sign in to comment.