mathworks / MATLAB-extension-for-vscode

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.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
234 stars 15 forks source link

Support formatting the code #75

Closed adam-sim-dev closed 10 months ago

adam-sim-dev commented 10 months ago

Is your feature request related to a problem? Please describe.

This extension can not format the Matlab .m scripts.

Describe the solution you'd like

I want to indent and format MATLAB code.

Describe alternatives you've considered

Now I use https://marketplace.visualstudio.com/items?itemName=AffenWiesel.matlab-formatter

Additional context Add any other context or screenshots about the feature request here.

dklilley commented 10 months ago

Hi @adam-sim-dev , can you please provide info about your request? Specifically, answering the above pre-populated questions should give more context.

adam-sim-dev commented 10 months ago

Updated.

dklilley commented 10 months ago

The extension does provide a code formatter, which currently requires a MATLAB installation. This is noted in the Advanced Features section of the README.

Is your request focused on the need for a formatter without a MATLAB installation?

adam-sim-dev commented 10 months ago

I have matlab installed. I will try formatting the code when I have some time.

adam-sim-dev commented 10 months ago

I have tried to select the default formatter using MATLAB Mathworks.lauguage-matlab. The formatting results are not so satisfactory. For example, won't add space between variables and operators.

mrtnbrst commented 10 months ago

You can use this instead: https://marketplace.visualstudio.com/items?itemName=AffenWiesel.matlab-formatter

dklilley commented 10 months ago

I see, thank you for clarifying! There is a separate request which is already tracking more advanced code formatting capabilities: #7. This is something we would like to add in the future.

I am closing this issue to avoid duplicate requests. If you have any specific requests for formatting, please feel free to add them to #7. Thanks!