File tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ Unreleased]
9
9
10
+ ### Added
11
+ - Open non-code MATLAB files (e.g. ` .slx ` , ` .fig ` ) via the context menu
12
+
10
13
## [ 1.2.7] - 2024-11-07
11
14
12
15
### Added
Original file line number Diff line number Diff line change 132
132
},
133
133
{
134
134
"command" : " matlab.openFile" ,
135
- "when" : " editorLangId == matlab && editorHasSelection && resourceExtname != '.m'"
135
+ "when" : " editorHasSelection" ,
136
+ "group" : " files"
136
137
}
137
138
],
138
139
"explorer/context" : [
Original file line number Diff line number Diff line change @@ -297,4 +297,29 @@ export default class ExecutionCommandProvider {
297
297
298
298
void this . _mvm . feval ( 'cd' , 0 , [ uri . fsPath ] ) ;
299
299
}
300
+
301
+ /**
302
+ * Implements the open file action
303
+ * @param uri The file path to the file that should be opened
304
+ * @returns
305
+ */
306
+ async handleOpenFile ( uri : vscode . Uri ) : Promise < void > {
307
+ this . _telemetryLogger . logEvent ( {
308
+ eventKey : 'ML_VS_CODE_ACTIONS' ,
309
+ data : {
310
+ action_type : 'openFile' ,
311
+ result : ''
312
+ }
313
+ } ) ;
314
+
315
+ await this . _terminalService . openTerminalOrBringToFront ( ) ;
316
+
317
+ try {
318
+ await this . _mvm . getReadyPromise ( ) ;
319
+ } catch ( e ) {
320
+ return ;
321
+ }
322
+
323
+ void this . _mvm . feval ( 'open' , 0 , [ uri . fsPath ] ) ;
324
+ }
300
325
}
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export async function activate (context: vscode.ExtensionContext): Promise<void>
129
129
context . subscriptions . push ( vscode . commands . registerCommand ( 'matlab.addFolderToPath' , async ( uri : vscode . Uri ) => await executionCommandProvider . handleAddFolderToPath ( uri ) ) )
130
130
context . subscriptions . push ( vscode . commands . registerCommand ( 'matlab.addFolderAndSubfoldersToPath' , async ( uri : vscode . Uri ) => await executionCommandProvider . handleAddFolderAndSubfoldersToPath ( uri ) ) )
131
131
context . subscriptions . push ( vscode . commands . registerCommand ( 'matlab.changeDirectory' , async ( uri : vscode . Uri ) => await executionCommandProvider . handleChangeDirectory ( uri ) ) )
132
+ context . subscriptions . push ( vscode . commands . registerCommand ( 'matlab.openFile' , async ( uri : vscode . Uri ) => await executionCommandProvider . handleOpenFile ( uri ) ) )
132
133
133
134
// Register a custom command which allows the user enable / disable Sign In options.
134
135
// Using this custom command would be an alternative approach to going to enabling the setting.
You can’t perform that action at this time.
0 commit comments