You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fixed configure script to work in directories that contain spaces
7
+
- Added detection of source code type: clang-format can now apply different formatting to C/C++, Objective-C/C++, Java and JavaScript
8
+
- Changed patch application to individual lines rather than replacing the whole buffer. This preserves selections and breakpoints much better. Note that they are still removed in situations, e.g. when the code around the breakpoint is changed.
9
+
- Added command to format the entire file, rather than just the selection
10
+
- Renamed the existing command to "Format Selection". **This means you'll have to change your shortcut definitions**
This plugin written for Xcode 8's new plugin infrastructure uses Clang's `libclangFormat` library to format code according to a `.clang-format` file.
5
+
This plugin is written for Xcode 8's new plugin infrastructure and compatible through at least Xcode 11.4 It uses Clang's `libclangFormat` library to format code according to a `.clang-format` file.
6
6
7
7
Open the app, select a predefined style, or open the `.clang-format` file from your project:
8
8
@@ -12,15 +12,15 @@ Then, use the <kbd>Format Source Code</kbd> command in Xcode's <kbd>Editor</kbd>
12
12
13
13

14
14
15
-
Due to macOS Sandboxing restrictions, this Plugin behaves slightly differently compared to the command line `clang-format` command: It always uses the style selected in the configuration app, and will not use the nearest `.clang-format` file on disk.
15
+
Due to macOS sandboxing restrictions, this plugin behaves slightly differently compared to the command line `clang-format` command: It always uses the style selected in the configuration app, and will not use the nearest `.clang-format` file on disk.
16
16
17
17
18
18
## Installing
19
19
20
20
Download the precompiled app or [build it yourself](#building), then open the app. You might have to right click on the app bundle, and choose <kbd>Open</kbd> to run non-codesigned applications. Then,
21
21
22
22
* On OS X 10.11, you'll need to run `sudo /usr/libexec/xpccachectl`, then **reboot** to enable app extensions.
23
-
* On macOS Sierra, extensions should be loaded by default.
23
+
* On macOS Sierra and later, extensions should be loaded by default.
24
24
25
25
Then, go to *System Preferences* → *Extensions*, and make sure that **clang-format** in the *Xcode Source Editor* section is checked:
26
26
@@ -29,7 +29,7 @@ Then, go to *System Preferences* → *Extensions*, and make sure that **clang-fo
29
29
30
30
## Keyboard shortcut
31
31
32
-
To define a keyboard shortcut, open *System Preferences*, click on *Keyboard*, and switch to the *Shortcuts* tab. In the list on the left, select *App Shortcuts*, then hit the <kbd>+</kbd> button. Select Xcode, enter `Format Source Code`, and define a shortcut of your liking.
32
+
To define a keyboard shortcut, open Xcode's preferences, and switch to the *Key Bindings* tab. Duplicate the default key binding set if you don't have your own set already. Search for `clang-format`, then add your preferred key bindings for `Format Selection` or `Format Entire File`.
0 commit comments