Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening figures, simulink models, etc. in VS Code #188

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Open non-code MATLAB files (e.g. `.slx`, `.fig`) via the context menu

## [1.2.7] - 2024-11-07

### Added
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"command": "matlab.enableSignIn",
"title": "MATLAB: Manage Sign In Options"
},
{
"command": "matlab.openFile",
"title": "MATLAB: Open File"
},
{
"command": "matlab.resetDeprecationPopups",
"title": "MATLAB: Reset Deprecation Warning Popups"
Expand Down Expand Up @@ -135,6 +139,11 @@
{
"command": "matlab.changeDirectory",
"when": "explorerResourceIsFolder"
},
{
"command": "matlab.openFile",
"when": "!explorerResourceIsFolder",
"group": "files"
}
],
"matlab.addPath": [
Expand Down
2 changes: 1 addition & 1 deletion server
Submodule server updated 107 files
25 changes: 25 additions & 0 deletions src/commandwindow/ExecutionCommandProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,29 @@

void this._mvm.feval('cd', 0, [uri.fsPath]);
}

/**
* Implements the open file action
* @param uri The file path to the file that should be opened
* @returns
*/
async handleOpenFile(uri: vscode.Uri): Promise<void> {

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-R2021a-windows-latest

Missing space before function parentheses

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-R2021a-ubuntu-latest

Missing space before function parentheses

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-R2021a-macos-13

Missing space before function parentheses

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-latest-windows-latest

Missing space before function parentheses

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-latest-ubuntu-latest

Missing space before function parentheses

Check failure on line 306 in src/commandwindow/ExecutionCommandProvider.ts

View workflow job for this annotation

GitHub Actions / smoke-latest-macos-13

Missing space before function parentheses
Gusmano-2-OSU marked this conversation as resolved.
Show resolved Hide resolved
this._telemetryLogger.logEvent({
eventKey: 'ML_VS_CODE_ACTIONS',
data: {
action_type: 'openFile',
result: ''
}
});

await this._terminalService.openTerminalOrBringToFront();

try {
await this._mvm.getReadyPromise();
} catch (e) {
return;
}

void this._mvm.feval('open', 0, [uri.fsPath]);
}
}
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export async function activate (context: vscode.ExtensionContext): Promise<void>
context.subscriptions.push(vscode.commands.registerCommand('matlab.addFolderToPath', async (uri: vscode.Uri) => await executionCommandProvider.handleAddFolderToPath(uri)))
context.subscriptions.push(vscode.commands.registerCommand('matlab.addFolderAndSubfoldersToPath', async (uri: vscode.Uri) => await executionCommandProvider.handleAddFolderAndSubfoldersToPath(uri)))
context.subscriptions.push(vscode.commands.registerCommand('matlab.changeDirectory', async (uri: vscode.Uri) => await executionCommandProvider.handleChangeDirectory(uri)))
context.subscriptions.push(vscode.commands.registerCommand('matlab.openFile', async (uri: vscode.Uri) => await executionCommandProvider.handleOpenFile(uri)))

// Register a custom command which allows the user enable / disable Sign In options.
// Using this custom command would be an alternative approach to going to enabling the setting.
Expand Down
Loading