-
Notifications
You must be signed in to change notification settings - Fork 20
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
Disable indentation on the root-level of a function #255
Comments
There is no way to do this right now. Let me see how hard it would be to add... |
So I think this is really specific, right? You just want this for top-level functions in function files. All other functions (nested, in class files, etc.) would be indentend normally? At least that is what a cursory survey of the various coding snippets on the mathworks website suggests... |
thanks for looking into this - only disabling the indentation for the main/top function is fine for me. because most of my toolboxes have a single function per unit/file. having a leading indentation for every line looks a little bit clunky and redundant for such format. but of course, if it takes more efforts to separately handle top function and embedded functions, it is also fine to have a flag to disable both. whichever is easier to implement. |
New option to NOT indent the function body of a top-level function.
I have pushed a proposal fix for this. Could you try it please and let me know if it meets your needs? |
The CHANGELOG entry should explain how to activate it:
|
thank you so much! works like a charm! feel free to close the issue. I noticed one thing: when I set
I wonder if this is the right place to set this flag? |
never mind. I figured out, need to use |
I know this might belong to a separate issue - would it be possible to add an option to only remove indentation of the docstrings (the block of commented lines right before or after the function declaration) of each top level function? sorry for asking too many wishes. |
@fangq please make that a separate ticket with an example of what you need. |
What kind of feature is this?
I have been following the default MATLAB formatting styles to format my own toolboxes/functions, something looks like this:
I just tried miss_hit, and found that the formatted function has indentations for all docstring and command lines
I am wondering if there is an option to disable this leading indentation for the root-level of a function, so that the formatted file follows MATLAB's style?
thanks
Your MATLAB/Octave environment
The text was updated successfully, but these errors were encountered: