4

So I am editing a HTML file with a bunch of javascript in it that I am using in my iOS project. Xcode is doing a terrible job of letting me indent things. Is there any way to mess with the indentation settings at all? Things are just getting really hard to read.

enter image description here

Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
  • Don't copy and paste this code in Xcode. Edit this code in any other compatible editor and then simply drag and drop that file into Xcode. – Gaurav Chandarana Sep 25 '18 at 08:07

1 Answers1

1

There's a preference in Xcode for this.

Indentation Preferences

This will likely not help the text currently in the files you're editing (since the indentations / spaces are already there and to change them, you need to do some manual editing), but modifying these preferences will help you going forward.

Also, here's a related question with answers that may help you further.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Actually, you can highlight the text, right-click, and choose Something I Forgot > Re-Indent – Undo May 31 '13 at 17:53
  • The "Structure" submenu. Nice catch! – Michael Dautermann May 31 '13 at 18:00
  • Yep. Pretty useful when one of those `if` statements inside a completion block combined with a missing semicolon somewhere confuses Xcode, causing it to think everything is a `pragma` statement :) – Undo May 31 '13 at 18:10