AppCode更新后注释缩进异常及多行语句对齐问题求助
Hey there! Sorry to hear those post-update formatting quirks are throwing off your Objective-C workflow in AppCode—let’s get this sorted out step by step.
1. Fixing Comment Indentation After Pressing Enter
That annoying persistent indent after comments is almost certainly a smart key or code style setting that got flipped during the update. Here’s how to revert it:
- Open AppCode’s preferences (press
Cmd+,on Mac, orCtrl+Alt+Son Windows/Linux) - Navigate to Editor > General > Smart Keys
- Scroll down to the
Commentssection, and uncheck the box for Start new line with comment. This stops AppCode from auto-extending the comment indent to the next line. - Double-check your Objective-C code style settings: Head to Editor > Code Style > Objective-C > Indentation, and make sure
Indent after '//' commentsis set to0(so your next line aligns with the base code indent, not the comment).
2. Restoring Colon Alignment for Multi-Line Statements
The missing colon alignment is likely a code style toggle that got disabled. Fix it like this:
- Stay in Editor > Code Style > Objective-C, and switch to the Wrapping and Braces tab
- Look for two key sections:
- Method declarations: Find the
Align colonsoption under parameter wrapping settings, and check it. This ensures colons line up when you split method declarations across lines. - Method calls: Do the same here—enable
Align colonsso your multi-line method calls keep their colons aligned properly.
- Method declarations: Find the
- If you use property declarations or other colon-heavy syntax, check related sections (like
Property declarations) for similar alignment options.
Bonus: If Settings Don’t Stick
Sometimes update caches can mess with setting changes. Try this if the above steps don’t work:
- Go to File > Invalidate Caches...
- Select
Invalidate and Restartto clear old cache files and reload AppCode with your new settings. - If all else fails, you can reset your Objective-C code style to default: In the Code Style settings, click the gear icon in the top-right corner and select
Restore Defaults, then re-apply your preferred tweaks.
Give these steps a shot—most post-update formatting issues come down to settings being reset or toggled unexpectedly during the update. Hopefully this gets your workflow back to normal!
内容的提问来源于stack exchange,提问作者Stoph

