How do you indent preprocessor statements?

Just because preprocessing directives are “normally” not indented is not a good reason not to indent them: #ifdef __WIN32__ #include <pansen_win32> #else #include <..> #ifdef SOMEOTHER stmts #endif maybe stmts #endif If you frequently have multiple levels of nesting of preprocessing directives, you should rework them to make them simpler.

‘Format code’ and ‘sort using’ on save in Visual Studio 2022

Starting from VS2022-Preview2, there is no need to additional extension to “format on-save”, you just run a customized code cleanup that contains “Format document” action on-save: Customize your cleanup profile to perform “Format document” action (if not already there), in Analyze > Code Cleanup > Configure Code Cleanup Enable “Run code cleanup profile on save” … Read more

How to change Visual Studio 2012 Razor colors

Optional: Install the color theme editor: http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05 In the theme editor or Tools > Options > Environment > Fonts and Colors Search for: ‘HTML Server-Side Script’ to edit the foreground & background of @ and other tags. Search for: ‘Razor Code’ to edit the background of the Razor code.

How to indent after access modifiers with clang-format

Where I work, we’ve stumbled upon the same problem. Since the IndentWidth parameter controls the indentation everywhere (classes, functions, etc.) what you’re trying to achieve seems impossible. The next best thing, in my opinion, is to keep IndentWidth=4 and set AccessModifierOffset=-2. That way you get: class Foo { public: Foo() = default; }; bool foo() … Read more

Turn off Eclipse formatter for selected code area? [duplicate]

To prevent specific portions of Java code from being formatted, go to “Window > Preferences > Java > Code Style > Formatter”. Click the “Edit…” button, go to the “Off/On Tags” tab and enable the tags. Afterwards, you can simply embed those tags in Java code to disable the formatting in-between them. If you don’t … Read more

Printing code with syntax highlighting? [closed]

You can use Vim! It’s probably installed already if you’re on modern Linux/MacOS and an easy install if not. :syntax will turn syntax highlighting on and :hardcopy will print it. There’s syntax highlighting definitions for many languages out there. The default look is usually optimised for screen display, but you can fix that. Simply open … Read more

How can I force Xcode to retain my indentation when I copy and paste?

Works as intended. …Objects: and forKeys: should be aligned as they form part of the same method signature. It might be easier to format your code if you use the new object literal syntax: – (int)minBrokenPieces { NSDictionary *mapping = [NSDictionary dictionaryWithObjects:@[@”3″, @”4″, @”4″, @”5″, @”6″, @”7″, @”8″] forKeys:[Note types]]; [(NSString *)mapping[self.note.type] integerValue]; } As … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)