bcomnes / sublime-standard-format

:sparkles: Runs standard --fix against the javascript in your ST3 window on save or manually.
https://packagecontrol.io/packages/StandardFormat
MIT License
60 stars 21 forks source link

Disable auto-formatting on save #85

Closed prabhavdogra closed 3 years ago

prabhavdogra commented 3 years ago

Can we disable auto formatting of code on saving as it removes indentation from macros and #ifdef among other things.

Example: 
Original Text - 
#ifdef DEBUG
    #include "Headers/debug.cpp"
#else
    #define d(...) 0
    #pragma GCC optimize("O3")
    #pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")
#endif
Text on saving - 
#ifdef DEBUG
#include "Headers/debug.cpp"
#else
#define d(...) 0
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")
#endif
bcomnes commented 3 years ago

You can toggle format on save on or off from the context menu. It sometimes gets in the way. What formatter is doing this?

prabhavdogra commented 3 years ago

I tried all the pre installed formatters and all of them are formatting it in in the wrong way same is happening for macro of loops

Before:
#define forp(i,a,b) for(int i = (int)a; i < (int)b; i++)
forp(i, 0, n)
        cin >> a[i];
After:
forp(i, 0, n)
cin >> a[i];

Also a little more detail about where in context menu will be greatly appreciated. Thank you,

bcomnes commented 3 years ago

The ctl-p menu then filer for standard format

Screen Shot 2021-08-16 at 1 24 51 PM