Skip to content

Commit 1cdb339

Browse files
authored
Merge pull request #209 from mathworks/dklilley/release/1.3.1
MATLAB extension for VS Code - v1.3.1
2 parents 14fec1a + d176a90 commit 1cdb339

File tree

6 files changed

+44
-17
lines changed

6 files changed

+44
-17
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.3.1] - 2025-01-23
11+
12+
### Added
13+
- The extension keeps the MATLAB path in sync with the VS Code workspace, improving code navigation, completions, and execution
14+
- The extension keeps the MATLAB debug workspace in sync with the selected callstack in VS Code
15+
16+
### Fixed
17+
- Changing the default value of `MATLAB.startDebuggerAutomatically` to `false`
18+
- Resolves errors with document formatting when using with MATLAB R2025a
19+
- Resolves errors with execution and debugging when using with MATLAB R2022a
20+
1021
## [1.3.0] - 2024-12-18
1122

1223
### Notice

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The extension provides several basic features, regardless of whether you have MA
2121
![MATLAB Extension Demo](public/BasicFeatures.gif)
2222

2323
### Advanced Features (requires MATLAB installed on your system)
24-
If you have MATLAB R2021a or later installed on your system, you have access to an additional set of advanced features. These features include:
24+
If you have MATLAB R2021b or later installed on your system, you have access to an additional set of advanced features. These features include:
2525
* Code execution and debugging
2626
* Automatic code completion
2727
* Source code formatting (document formatting)
@@ -46,13 +46,12 @@ There are some limitations to running and debugging MATLAB code in Visual Studio
4646
* Creating a custom run configuration for a file is not supported.
4747
* When using the **dbstop** and **dbclear** functions to set and clear breakpoints, the breakpoints are added to file but are not shown in Visual Studio Code.
4848
* Variable values changed in the MATLAB terminal when Visual Studio Code is paused do not update in the **Run and Debug** view until the next time Visual Studio Code pauses.
49-
* Changing which stack frame is selected in Visual Studio Code will not automatically change the workspace used by the MATLAB terminal when debugging
5049

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

5453
### MATLAB Install Path Setting
55-
If you have MATLAB installed on your system, the extension automatically checks the system path for the location of the MATLAB executable. If the MATLAB executable is not on the system path, you may need to manually set the `matlab.installPath` setting to the full path of your MATLAB installation. For example, `C:\Program Files\MATLAB\R2022b` (Windows®), `/Applications/MATLAB_R2022b.app` (macOS), or `/usr/local/MATLAB/R2022b` (Linux®).
54+
If you have MATLAB installed on your system, the extension automatically checks the system path for the location of the MATLAB executable. If the MATLAB executable is not on the system path, you may need to manually set the `MATLAB.installPath` setting to the full path of your MATLAB installation. For example, `C:\Program Files\MATLAB\R2022b` (Windows®), `/Applications/MATLAB_R2022b.app` (macOS), or `/usr/local/MATLAB/R2022b` (Linux®).
5655

5756
You can determine the full path of your MATLAB installation by using the `matlabroot` command in MATLAB.
5857

@@ -62,37 +61,37 @@ matlabroot
6261
ans =
6362
'C:\Program Files\MATLAB\R2022b'
6463
```
65-
In the extension settings, set the `matlab.installPath` setting to the value returned by the `matlabroot` command.
64+
In the extension settings, set the `MATLAB.installPath` setting to the value returned by the `matlabroot` command.
6665

6766
![MATLAB Install Path Setting](public/InstallPathSetting.png)
6867

6968
### MATLAB Automatically Start Debugger Setting
70-
By default, the extension automatically starts the Visual Studio Code debugger when MATLAB reaches a breakpoint. To disable automatically starting the Visual Studio Code debugger, set the `matlab.automaticallyStartDebugger` setting to `false`. When starting the Visual Studio Debugger is disabled, MATLAB still stops at breakpoints, and you can debug your code in the MATLAB terminal using the MATLAB debugging functions.
69+
By default, the extension does not automatically start the Visual Studio Code debugger when MATLAB reaches a breakpoint. To enable automatically starting the Visual Studio Code debugger, set the `MATLAB.startDebuggerAutomatically` setting to `true`. When starting the Visual Studio Debugger is disabled, MATLAB still stops at breakpoints, and you can debug your code in the MATLAB terminal using the MATLAB debugging functions.
7170

7271
### MATLAB Index Workspace Setting
7372
By default, the extension indexes all the MATLAB code files (`.m`) in your current workspace. Indexing allows the extension to find and navigate between your MATLAB code files.
74-
You can disable indexing to improve the performance of the extension. To disable indexing, set the `matlab.indexWorkspace` setting to `false`. Disabling indexing can cause features such as code navigation not to function as expected.
73+
You can disable indexing to improve the performance of the extension. To disable indexing, set the `MATLAB.indexWorkspace` setting to `false`. Disabling indexing can cause features such as code navigation not to function as expected.
7574

7675
### MATLAB Connection Timing Setting
77-
By default, the extension starts MATLAB in the background when you open a MATLAB code file in Visual Studio Code. To control when the extension starts MATLAB, set the `matlab.matlabConnectionTiming` setting to one of these values:
76+
By default, the extension starts MATLAB in the background when you open a MATLAB code file in Visual Studio Code. To control when the extension starts MATLAB, set the `MATLAB.matlabConnectionTiming` setting to one of these values:
7877
* `onStart` (default) — Start MATLAB as soon as a MATLAB code file is opened.
7978
* `onDemand` — Start MATLAB only when needed for a given action.
8079
* `never` — Never start MATLAB.
8180
Note: Some functionality is available only with MATLAB running in the background.
8281

8382
### MATLAB Max File Size for Analysis Setting
84-
By default, the extension analyzes all files, regardless of their size, for features such as linting, code navigation, and symbol renaming. To limit the maximum number of characters a file can contain, set the `matlab.maxFileSizeForAnalysis` setting. For example, to limit the number of characters to 50,000, set the `matlab.maxFileSizeForAnalysis` setting to `50000`. If a file contains more than the maximum number of characters, features such as linting, code navigation, and symbol renaming are disabled for that file. To remove the limit and analyze all files regardless of their size, set the `matlab.maxFileSizeForAnalysis` setting to `0`.
83+
By default, the extension analyzes all files, regardless of their size, for features such as linting, code navigation, and symbol renaming. To limit the maximum number of characters a file can contain, set the `MATLAB.maxFileSizeForAnalysis` setting. For example, to limit the number of characters to 50,000, set the `MATLAB.maxFileSizeForAnalysis` setting to `50000`. If a file contains more than the maximum number of characters, features such as linting, code navigation, and symbol renaming are disabled for that file. To remove the limit and analyze all files regardless of their size, set the `MATLAB.maxFileSizeForAnalysis` setting to `0`.
8584

8685
### MATLAB Show Feature Not Available Error Setting
87-
By default, the extension displays an error when a feature requires MATLAB and MATLAB is unable to start. To not display an error, set the `matlab.showFeatureNotAvailableError` setting to `false`.
86+
By default, the extension displays an error when a feature requires MATLAB and MATLAB is unable to start. To not display an error, set the `MATLAB.showFeatureNotAvailableError` setting to `false`.
8887

8988
### MATLAB Sign In Setting
9089
By default, the extension assumes that the MATLAB installation specified in the Install Path setting is activated.
9190

92-
To enable browser-based sign in to your MathWorks account using the Online License Manager or a Network License Manager, set the `matlab.signIn` setting to true. When this setting is enabled, the extension prompts you to sign in when it starts MATLAB.
91+
To enable browser-based sign in to your MathWorks account using the Online License Manager or a Network License Manager, set the `MATLAB.signIn` setting to true. When this setting is enabled, the extension prompts you to sign in when it starts MATLAB.
9392

9493
### MATLAB Telemetry Setting
95-
You can help improve the extension by sending user experience information to MathWorks®. By default, the extension sends user experience information to MathWorks. To disable sending information, set the `matlab.telemetry` setting to `false`.
94+
You can help improve the extension by sending user experience information to MathWorks®. By default, the extension sends user experience information to MathWorks. To disable sending information, set the `MATLAB.telemetry` setting to `false`.
9695

9796
For more information, see the [MathWorks Privacy Policy](https://www.mathworks.com/company/aboutus/policies_statements.html).
9897

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Edit MATLAB code with syntax highlighting, linting, navigation support, and more",
55
"icon": "public/L-Membrane_RGB_128x128.png",
66
"license": "MIT",
7-
"version": "1.3.0",
7+
"version": "1.3.1",
88
"engines": {
99
"vscode": "^1.67.0"
1010
},
@@ -214,7 +214,7 @@
214214
},
215215
"MATLAB.startDebuggerAutomatically": {
216216
"type": "boolean",
217-
"default": true,
217+
"default": false,
218218
"markdownDescription": "Automatically start the Visual Studio Code debugger when MATLAB reaches a breakpoint.",
219219
"scope": "window"
220220
},

src/debug/MatlabDebugger.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 The MathWorks, Inc.
1+
// Copyright 2024-2025 The MathWorks, Inc.
22

33
import * as vscode from 'vscode'
44
import { Notifier } from '../commandwindow/Utilities';
@@ -143,6 +143,23 @@ export default class MatlabDebugger {
143143
}
144144
});
145145

146+
// API not present prior to VS Code version 1.92
147+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
148+
if ((vscode.debug as any).onDidChangeActiveStackItem !== undefined) {
149+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
150+
(vscode.debug as any).onDidChangeActiveStackItem((frame: any) => {
151+
if (this._baseDebugSession !== null) {
152+
return;
153+
}
154+
155+
if (!this._activeSessions.has(frame.session) || frame.session === this._baseDebugSession) {
156+
return;
157+
}
158+
159+
frame.session.customRequest('StackChange', { frame: frame.frameId as number });
160+
});
161+
}
162+
146163
// eslint-disable-next-line @typescript-eslint/no-misused-promises
147164
this._mvm.on(MVM.Events.stateChanged, this._handleMvmStateChange.bind(this));
148165
// eslint-disable-next-line @typescript-eslint/no-misused-promises

0 commit comments

Comments
 (0)