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

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

Gusmano-2-OSU
Copy link
Contributor

Implements opening .fig, .slx and other MATLAB files through VS code's context menu.

Note! I'm brand new to developing in TypeScript, and I'm having some implementation issues (specifically, getting the menu option to occur in the context menu.) Still, I wanted to put this here in case @dklilley or any of the other maintainers want to help with the final steps!

@dklilley
Copy link
Member

Hi @Gusmano-2-OSU, thanks for working on this! I will plan to take a look at this soon (likely early next week).

Before I take a look, I just wanted to clarify - you are having some difficulty getting the "MATLAB: Open File" option added into the context menu?

@Gusmano-2-OSU
Copy link
Contributor Author

Hey @dklilley, that's exactly right! The idea is, you right click any file supported by MATLAB's open command, and you get a context menu command that lets you run the command on that file. As someone who works a lot with figures and Simulink models, I'm hoping it can significantly increase the speed of my workflow!

My dream implementation of this is that a normal click would open these files as a tab in the current vs code window, but it would definitely be good enough if they opened in a separate MATLAB window.

Thanks for taking a look!

package.json Outdated Show resolved Hide resolved
@dklilley
Copy link
Member

I believe that the issue is just with where the configuration for the context menu item was being added within package.json. Take a look at my comment and see if it helps!

@Gusmano-2-OSU Gusmano-2-OSU marked this pull request as ready for review November 18, 2024 21:26
@Gusmano-2-OSU
Copy link
Contributor Author

Hey @dklilley, thanks for the suggestions! I was able to get it to work with the tips you gave. As I tried it out though, I thought it would be a little slow to open one at a time, so I tried adding functionality to select multiple files, and then executing the command to open all of them. I think there's a slight issue with the for loop, but I'm requesting the review anyway to show that the last problem was fixed! Do you have any suggestions on how to fix for loop issue?

@dklilley
Copy link
Member

I don't think there are any issues with the loop as you have written it. Instead, even if there are multiple files selected in the Explorer, only one URI is passed to the command.

Unfortunately, after some digging, I don't believe that this is functionality which is publicly available for extensions to leverage.

While there are some context menu actions which do work with multiple files selected (e.g. Open to the Side), these are commands provided my Microsoft and are implemented internally (e.g. the implementation of Open to the Side leverages an internal getMultiSelectedResources API).

@Gusmano-2-OSU
Copy link
Contributor Author

That's too bad - maybe a project for another day if we could ever use the getMultiSelectedResources API. For now, I've reverted the commit and this should be ready to pull!

@dklilley dklilley self-assigned this Nov 19, 2024
@dklilley
Copy link
Member

Agreed - hopefully they add some public functionality soon!

The changes look good to me! One of my colleagues will be reaching out soon with information about signing the CLA.

@nothans
Copy link
Member

nothans commented Nov 21, 2024

Hi. Thanks for the contribution! Can you contact me about signing the CLA? I can help from there. Thanks.

@Gusmano-2-OSU
Copy link
Contributor Author

I sent you an email, @nothans!

@dklilley dklilley merged commit 50dcd07 into mathworks:main Dec 3, 2024
12 checks passed
@dklilley
Copy link
Member

dklilley commented Dec 3, 2024

Thanks for working on this!

@Gusmano-2-OSU
Copy link
Contributor Author

Sure thing! I look forward to contributing more in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants