├── .gitignore
├── ClangFormat
├── ClangFormat.entitlements
├── Info.plist
├── SourceEditorCommand.swift
└── SourceEditorExtension.swift
├── ClangFormatter.xcodeproj
├── project.pbxproj
└── xcshareddata
│ └── xcschemes
│ ├── ClangFormat.xcscheme
│ └── ClangFormatter.xcscheme
├── Code
└── AppDelegate.swift
├── LICENSE
├── README.md
├── Resources
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ └── MainMenu.xib
└── Info.plist
└── bin
└── clang-format
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | Makefile.local
3 | *.swp
4 | *tags
5 |
6 | # OS X
7 | ####################
8 | .Spotlight-V100/
9 | .Trashes/
10 | ._*
11 | .AppleDouble
12 | .DS_Store
13 | .LSOverride
14 | Icon?
15 |
16 | # Xcode
17 | ####################
18 | *.mode1v3
19 | *.mode2v3
20 | *.pbxuser
21 | *.perspectivev3
22 | *.user
23 | *.xcuserstate
24 | *.moved-aside
25 | *~.nib
26 | .idea/
27 | DerivedData/
28 | project.xcworkspace/
29 | xcuserdata/
30 | profile
31 | !default.pbxuser
32 | !default.mode1v3
33 | !default.mode2v3
34 | !default.perspectivev3
35 |
36 | # CocoaPods
37 | ####################
38 | Pods
39 | *.xcworkspace
40 |
41 |
--------------------------------------------------------------------------------
/ClangFormat/ClangFormat.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ClangFormat/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ClangFormat
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | $(MACOSX_DEPLOYMENT_TARGET)
27 | NSExtension
28 |
29 | NSExtensionAttributes
30 |
31 | XCSourceEditorCommandDefinitions
32 |
33 |
34 | XCSourceEditorCommandClassName
35 | $(PRODUCT_MODULE_NAME).SourceEditorCommand
36 | XCSourceEditorCommandIdentifier
37 | org.vu0.ClangFormat.SourceEditorCommand
38 | XCSourceEditorCommandName
39 | Format
40 |
41 |
42 | XCSourceEditorExtensionPrincipalClass
43 | $(PRODUCT_MODULE_NAME).SourceEditorExtension
44 |
45 | NSExtensionPointIdentifier
46 | com.apple.dt.Xcode.extension.source-editor
47 |
48 | NSHumanReadableCopyright
49 | Copyright © 2016 🚀. All rights reserved.
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ClangFormat/SourceEditorCommand.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SourceEditorCommand.swift
3 | // ClangFormat
4 | //
5 | // Created by Boris Bügling on 21/06/16.
6 | // Copyright © 2016 🚀. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import XcodeKit
11 |
12 | class SourceEditorCommand: NSObject, XCSourceEditorCommand {
13 | var commandPath: String {
14 | return Bundle.main.path(forResource: "clang-format", ofType: nil)!
15 | }
16 |
17 | static func run(_ commandPath: String, arguments: [String], stdin: String) -> String? {
18 | let errorPipe = Pipe()
19 | let outputPipe = Pipe()
20 |
21 | let task = Process()
22 | task.standardError = errorPipe
23 | task.standardOutput = outputPipe
24 | task.launchPath = commandPath
25 | task.arguments = arguments
26 |
27 | let inputPipe = Pipe()
28 | task.standardInput = inputPipe
29 | let stdinHandle = inputPipe.fileHandleForWriting
30 |
31 | if let data = stdin.data(using: .utf8) {
32 | stdinHandle.write(data)
33 | stdinHandle.closeFile()
34 | }
35 |
36 | task.launch()
37 | task.waitUntilExit()
38 |
39 | errorPipe.fileHandleForReading.readDataToEndOfFile()
40 |
41 | let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile()
42 | return String(data: outputData, encoding: .utf8)
43 | }
44 |
45 | func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) {
46 | if let outputString = SourceEditorCommand.run(commandPath,
47 | arguments: [ "-style=llvm" ],
48 | stdin: invocation.buffer.completeBuffer),
49 | invocation.buffer.contentUTI == "public.objective-c-source" {
50 | invocation.buffer.lines.removeAllObjects()
51 |
52 | let lines = outputString.characters.split(separator: "\n").map { String($0) }
53 | invocation.buffer.lines.addObjects(from: lines)
54 |
55 | // Crashes Xcode when replacing `completeBuffer`
56 | //invocation.buffer.completeBuffer = outputString
57 |
58 | // If there is a no longer valid selection, Xcode crashes
59 | invocation.buffer.selections.removeAllObjects()
60 | // and it does the same if there aren't any selections, so we set the insertion point
61 | invocation.buffer.selections.add(XCSourceTextRange(start: XCSourceTextPosition(line: 0, column: 0),
62 | end: XCSourceTextPosition(line: 0, column: 0)))
63 | }
64 |
65 | completionHandler(nil)
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ClangFormat/SourceEditorExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SourceEditorExtension.swift
3 | // ClangFormat
4 | //
5 | // Created by Boris Bügling on 21/06/16.
6 | // Copyright © 2016 🚀. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import XcodeKit
11 |
12 | class SourceEditorExtension: NSObject, XCSourceEditorExtension {
13 |
14 | /*
15 | func extensionDidFinishLaunching() {
16 | // If your extension needs to do any work at launch, implement this optional method.
17 | }
18 | */
19 |
20 | /*
21 | var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: AnyObject]] {
22 | // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter.
23 | return []
24 | }
25 | */
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/ClangFormatter.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | A11B69171D19F37D00802D08 /* clang-format in Resources */ = {isa = PBXBuildFile; fileRef = A1417CD41D19ED17005DEFA3 /* clang-format */; };
11 | A1417CB01D19E832005DEFA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1417CAF1D19E832005DEFA3 /* AppDelegate.swift */; };
12 | A1417CB21D19E833005DEFA3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1417CB11D19E833005DEFA3 /* Assets.xcassets */; };
13 | A1417CB51D19E833005DEFA3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1417CB31D19E833005DEFA3 /* MainMenu.xib */; };
14 | A1417CC41D19EB7D005DEFA3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1417CC31D19EB7D005DEFA3 /* Cocoa.framework */; };
15 | A1417CC91D19EB7D005DEFA3 /* SourceEditorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1417CC81D19EB7D005DEFA3 /* SourceEditorExtension.swift */; };
16 | A1417CCB1D19EB7D005DEFA3 /* SourceEditorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1417CCA1D19EB7D005DEFA3 /* SourceEditorCommand.swift */; };
17 | A1417CCF1D19EB7D005DEFA3 /* ClangFormat.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = A1417CC11D19EB7D005DEFA3 /* ClangFormat.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | A1417CCD1D19EB7D005DEFA3 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = A1417CA41D19E832005DEFA3 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = A1417CC01D19EB7D005DEFA3;
26 | remoteInfo = ClangFormat;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXCopyFilesBuildPhase section */
31 | A1417CD31D19EB7D005DEFA3 /* Embed App Extensions */ = {
32 | isa = PBXCopyFilesBuildPhase;
33 | buildActionMask = 2147483647;
34 | dstPath = "";
35 | dstSubfolderSpec = 13;
36 | files = (
37 | A1417CCF1D19EB7D005DEFA3 /* ClangFormat.appex in Embed App Extensions */,
38 | );
39 | name = "Embed App Extensions";
40 | runOnlyForDeploymentPostprocessing = 0;
41 | };
42 | /* End PBXCopyFilesBuildPhase section */
43 |
44 | /* Begin PBXFileReference section */
45 | A1417CAC1D19E832005DEFA3 /* ClangFormatter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ClangFormatter.app; sourceTree = BUILT_PRODUCTS_DIR; };
46 | A1417CAF1D19E832005DEFA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
47 | A1417CB11D19E833005DEFA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
48 | A1417CB41D19E833005DEFA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
49 | A1417CB61D19E833005DEFA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
50 | A1417CC11D19EB7D005DEFA3 /* ClangFormat.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ClangFormat.appex; sourceTree = BUILT_PRODUCTS_DIR; };
51 | A1417CC31D19EB7D005DEFA3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
52 | A1417CC71D19EB7D005DEFA3 /* ClangFormat.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ClangFormat.entitlements; sourceTree = ""; };
53 | A1417CC81D19EB7D005DEFA3 /* SourceEditorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorExtension.swift; sourceTree = ""; };
54 | A1417CCA1D19EB7D005DEFA3 /* SourceEditorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorCommand.swift; sourceTree = ""; };
55 | A1417CCC1D19EB7D005DEFA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | A1417CD41D19ED17005DEFA3 /* clang-format */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = "clang-format"; path = "bin/clang-format"; sourceTree = SOURCE_ROOT; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | A1417CA91D19E832005DEFA3 /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | A1417CBE1D19EB7D005DEFA3 /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | A1417CC41D19EB7D005DEFA3 /* Cocoa.framework in Frameworks */,
72 | );
73 | runOnlyForDeploymentPostprocessing = 0;
74 | };
75 | /* End PBXFrameworksBuildPhase section */
76 |
77 | /* Begin PBXGroup section */
78 | A1417CA31D19E831005DEFA3 = {
79 | isa = PBXGroup;
80 | children = (
81 | A1417CC51D19EB7D005DEFA3 /* ClangFormat */,
82 | A1417CAE1D19E832005DEFA3 /* Code */,
83 | A1417CC21D19EB7D005DEFA3 /* Frameworks */,
84 | A1417CAD1D19E832005DEFA3 /* Products */,
85 | A1417CBC1D19E84E005DEFA3 /* Resources */,
86 | );
87 | sourceTree = "";
88 | };
89 | A1417CAD1D19E832005DEFA3 /* Products */ = {
90 | isa = PBXGroup;
91 | children = (
92 | A1417CAC1D19E832005DEFA3 /* ClangFormatter.app */,
93 | A1417CC11D19EB7D005DEFA3 /* ClangFormat.appex */,
94 | );
95 | name = Products;
96 | sourceTree = "";
97 | };
98 | A1417CAE1D19E832005DEFA3 /* Code */ = {
99 | isa = PBXGroup;
100 | children = (
101 | A1417CAF1D19E832005DEFA3 /* AppDelegate.swift */,
102 | );
103 | path = Code;
104 | sourceTree = "";
105 | };
106 | A1417CBC1D19E84E005DEFA3 /* Resources */ = {
107 | isa = PBXGroup;
108 | children = (
109 | A1417CB11D19E833005DEFA3 /* Assets.xcassets */,
110 | A1417CB61D19E833005DEFA3 /* Info.plist */,
111 | A1417CB31D19E833005DEFA3 /* MainMenu.xib */,
112 | );
113 | path = Resources;
114 | sourceTree = "";
115 | };
116 | A1417CC21D19EB7D005DEFA3 /* Frameworks */ = {
117 | isa = PBXGroup;
118 | children = (
119 | A1417CC31D19EB7D005DEFA3 /* Cocoa.framework */,
120 | );
121 | name = Frameworks;
122 | sourceTree = "";
123 | };
124 | A1417CC51D19EB7D005DEFA3 /* ClangFormat */ = {
125 | isa = PBXGroup;
126 | children = (
127 | A1417CC81D19EB7D005DEFA3 /* SourceEditorExtension.swift */,
128 | A1417CCA1D19EB7D005DEFA3 /* SourceEditorCommand.swift */,
129 | A1417CC61D19EB7D005DEFA3 /* Supporting Files */,
130 | );
131 | path = ClangFormat;
132 | sourceTree = "";
133 | };
134 | A1417CC61D19EB7D005DEFA3 /* Supporting Files */ = {
135 | isa = PBXGroup;
136 | children = (
137 | A1417CD41D19ED17005DEFA3 /* clang-format */,
138 | A1417CC71D19EB7D005DEFA3 /* ClangFormat.entitlements */,
139 | A1417CCC1D19EB7D005DEFA3 /* Info.plist */,
140 | );
141 | name = "Supporting Files";
142 | sourceTree = "";
143 | };
144 | /* End PBXGroup section */
145 |
146 | /* Begin PBXNativeTarget section */
147 | A1417CAB1D19E832005DEFA3 /* ClangFormatter */ = {
148 | isa = PBXNativeTarget;
149 | buildConfigurationList = A1417CB91D19E833005DEFA3 /* Build configuration list for PBXNativeTarget "ClangFormatter" */;
150 | buildPhases = (
151 | A1417CA81D19E832005DEFA3 /* Sources */,
152 | A1417CA91D19E832005DEFA3 /* Frameworks */,
153 | A1417CAA1D19E832005DEFA3 /* Resources */,
154 | A1417CD31D19EB7D005DEFA3 /* Embed App Extensions */,
155 | A11B69191D19F9CF00802D08 /* Fix Permissions */,
156 | );
157 | buildRules = (
158 | );
159 | dependencies = (
160 | A1417CCE1D19EB7D005DEFA3 /* PBXTargetDependency */,
161 | );
162 | name = ClangFormatter;
163 | productName = ClangFormatter;
164 | productReference = A1417CAC1D19E832005DEFA3 /* ClangFormatter.app */;
165 | productType = "com.apple.product-type.application";
166 | };
167 | A1417CC01D19EB7D005DEFA3 /* ClangFormat */ = {
168 | isa = PBXNativeTarget;
169 | buildConfigurationList = A1417CD21D19EB7D005DEFA3 /* Build configuration list for PBXNativeTarget "ClangFormat" */;
170 | buildPhases = (
171 | A1417CBD1D19EB7D005DEFA3 /* Sources */,
172 | A1417CBE1D19EB7D005DEFA3 /* Frameworks */,
173 | A1417CBF1D19EB7D005DEFA3 /* Resources */,
174 | );
175 | buildRules = (
176 | );
177 | dependencies = (
178 | );
179 | name = ClangFormat;
180 | productName = ClangFormat;
181 | productReference = A1417CC11D19EB7D005DEFA3 /* ClangFormat.appex */;
182 | productType = "com.apple.product-type.xcode-extension";
183 | };
184 | /* End PBXNativeTarget section */
185 |
186 | /* Begin PBXProject section */
187 | A1417CA41D19E832005DEFA3 /* Project object */ = {
188 | isa = PBXProject;
189 | attributes = {
190 | LastSwiftUpdateCheck = 0800;
191 | LastUpgradeCheck = 0810;
192 | ORGANIZATIONNAME = "🚀";
193 | TargetAttributes = {
194 | A1417CAB1D19E832005DEFA3 = {
195 | CreatedOnToolsVersion = 8.0;
196 | DevelopmentTeam = 2EZDW5DVTJ;
197 | DevelopmentTeamName = "Boris Bügling (Personal Team)";
198 | LastSwiftMigration = 0810;
199 | ProvisioningStyle = Automatic;
200 | };
201 | A1417CC01D19EB7D005DEFA3 = {
202 | CreatedOnToolsVersion = 8.0;
203 | DevelopmentTeam = 2EZDW5DVTJ;
204 | DevelopmentTeamName = "Boris Bügling (Personal Team)";
205 | LastSwiftMigration = 0810;
206 | ProvisioningStyle = Automatic;
207 | SystemCapabilities = {
208 | com.apple.ApplicationGroups.Mac = {
209 | enabled = 0;
210 | };
211 | };
212 | };
213 | };
214 | };
215 | buildConfigurationList = A1417CA71D19E832005DEFA3 /* Build configuration list for PBXProject "ClangFormatter" */;
216 | compatibilityVersion = "Xcode 3.2";
217 | developmentRegion = English;
218 | hasScannedForEncodings = 0;
219 | knownRegions = (
220 | en,
221 | Base,
222 | );
223 | mainGroup = A1417CA31D19E831005DEFA3;
224 | productRefGroup = A1417CAD1D19E832005DEFA3 /* Products */;
225 | projectDirPath = "";
226 | projectRoot = "";
227 | targets = (
228 | A1417CAB1D19E832005DEFA3 /* ClangFormatter */,
229 | A1417CC01D19EB7D005DEFA3 /* ClangFormat */,
230 | );
231 | };
232 | /* End PBXProject section */
233 |
234 | /* Begin PBXResourcesBuildPhase section */
235 | A1417CAA1D19E832005DEFA3 /* Resources */ = {
236 | isa = PBXResourcesBuildPhase;
237 | buildActionMask = 2147483647;
238 | files = (
239 | A1417CB21D19E833005DEFA3 /* Assets.xcassets in Resources */,
240 | A1417CB51D19E833005DEFA3 /* MainMenu.xib in Resources */,
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | A1417CBF1D19EB7D005DEFA3 /* Resources */ = {
245 | isa = PBXResourcesBuildPhase;
246 | buildActionMask = 2147483647;
247 | files = (
248 | A11B69171D19F37D00802D08 /* clang-format in Resources */,
249 | );
250 | runOnlyForDeploymentPostprocessing = 0;
251 | };
252 | /* End PBXResourcesBuildPhase section */
253 |
254 | /* Begin PBXShellScriptBuildPhase section */
255 | A11B69191D19F9CF00802D08 /* Fix Permissions */ = {
256 | isa = PBXShellScriptBuildPhase;
257 | buildActionMask = 2147483647;
258 | files = (
259 | );
260 | inputPaths = (
261 | );
262 | name = "Fix Permissions";
263 | outputPaths = (
264 | );
265 | runOnlyForDeploymentPostprocessing = 0;
266 | shellPath = /bin/sh;
267 | shellScript = "chmod 775 ${CODESIGNING_FOLDER_PATH}/Contents/PlugIns/ClangFormat.appex/Contents/Resources/clang-format";
268 | };
269 | /* End PBXShellScriptBuildPhase section */
270 |
271 | /* Begin PBXSourcesBuildPhase section */
272 | A1417CA81D19E832005DEFA3 /* Sources */ = {
273 | isa = PBXSourcesBuildPhase;
274 | buildActionMask = 2147483647;
275 | files = (
276 | A1417CB01D19E832005DEFA3 /* AppDelegate.swift in Sources */,
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | };
280 | A1417CBD1D19EB7D005DEFA3 /* Sources */ = {
281 | isa = PBXSourcesBuildPhase;
282 | buildActionMask = 2147483647;
283 | files = (
284 | A1417CC91D19EB7D005DEFA3 /* SourceEditorExtension.swift in Sources */,
285 | A1417CCB1D19EB7D005DEFA3 /* SourceEditorCommand.swift in Sources */,
286 | );
287 | runOnlyForDeploymentPostprocessing = 0;
288 | };
289 | /* End PBXSourcesBuildPhase section */
290 |
291 | /* Begin PBXTargetDependency section */
292 | A1417CCE1D19EB7D005DEFA3 /* PBXTargetDependency */ = {
293 | isa = PBXTargetDependency;
294 | target = A1417CC01D19EB7D005DEFA3 /* ClangFormat */;
295 | targetProxy = A1417CCD1D19EB7D005DEFA3 /* PBXContainerItemProxy */;
296 | };
297 | /* End PBXTargetDependency section */
298 |
299 | /* Begin PBXVariantGroup section */
300 | A1417CB31D19E833005DEFA3 /* MainMenu.xib */ = {
301 | isa = PBXVariantGroup;
302 | children = (
303 | A1417CB41D19E833005DEFA3 /* Base */,
304 | );
305 | name = MainMenu.xib;
306 | path = .;
307 | sourceTree = "";
308 | };
309 | /* End PBXVariantGroup section */
310 |
311 | /* Begin XCBuildConfiguration section */
312 | A1417CB71D19E833005DEFA3 /* Debug */ = {
313 | isa = XCBuildConfiguration;
314 | buildSettings = {
315 | ALWAYS_SEARCH_USER_PATHS = NO;
316 | CLANG_ANALYZER_NONNULL = YES;
317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
318 | CLANG_CXX_LIBRARY = "libc++";
319 | CLANG_ENABLE_MODULES = YES;
320 | CLANG_ENABLE_OBJC_ARC = YES;
321 | CLANG_WARN_BOOL_CONVERSION = YES;
322 | CLANG_WARN_CONSTANT_CONVERSION = YES;
323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
324 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
325 | CLANG_WARN_EMPTY_BODY = YES;
326 | CLANG_WARN_ENUM_CONVERSION = YES;
327 | CLANG_WARN_INFINITE_RECURSION = YES;
328 | CLANG_WARN_INT_CONVERSION = YES;
329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
330 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
331 | CLANG_WARN_UNREACHABLE_CODE = YES;
332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
333 | CODE_SIGN_IDENTITY = "-";
334 | COPY_PHASE_STRIP = NO;
335 | DEBUG_INFORMATION_FORMAT = dwarf;
336 | ENABLE_STRICT_OBJC_MSGSEND = YES;
337 | ENABLE_TESTABILITY = YES;
338 | GCC_C_LANGUAGE_STANDARD = gnu99;
339 | GCC_DYNAMIC_NO_PIC = NO;
340 | GCC_NO_COMMON_BLOCKS = YES;
341 | GCC_OPTIMIZATION_LEVEL = 0;
342 | GCC_PREPROCESSOR_DEFINITIONS = (
343 | "DEBUG=1",
344 | "$(inherited)",
345 | );
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | MACOSX_DEPLOYMENT_TARGET = 10.11;
353 | MTL_ENABLE_DEBUG_INFO = YES;
354 | ONLY_ACTIVE_ARCH = YES;
355 | SDKROOT = macosx;
356 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
357 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
358 | };
359 | name = Debug;
360 | };
361 | A1417CB81D19E833005DEFA3 /* Release */ = {
362 | isa = XCBuildConfiguration;
363 | buildSettings = {
364 | ALWAYS_SEARCH_USER_PATHS = NO;
365 | CLANG_ANALYZER_NONNULL = YES;
366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
367 | CLANG_CXX_LIBRARY = "libc++";
368 | CLANG_ENABLE_MODULES = YES;
369 | CLANG_ENABLE_OBJC_ARC = YES;
370 | CLANG_WARN_BOOL_CONVERSION = YES;
371 | CLANG_WARN_CONSTANT_CONVERSION = YES;
372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
373 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
374 | CLANG_WARN_EMPTY_BODY = YES;
375 | CLANG_WARN_ENUM_CONVERSION = YES;
376 | CLANG_WARN_INFINITE_RECURSION = YES;
377 | CLANG_WARN_INT_CONVERSION = YES;
378 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
379 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
380 | CLANG_WARN_UNREACHABLE_CODE = YES;
381 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
382 | CODE_SIGN_IDENTITY = "-";
383 | COPY_PHASE_STRIP = NO;
384 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
385 | ENABLE_NS_ASSERTIONS = NO;
386 | ENABLE_STRICT_OBJC_MSGSEND = YES;
387 | GCC_C_LANGUAGE_STANDARD = gnu99;
388 | GCC_NO_COMMON_BLOCKS = YES;
389 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
390 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
391 | GCC_WARN_UNDECLARED_SELECTOR = YES;
392 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
393 | GCC_WARN_UNUSED_FUNCTION = YES;
394 | GCC_WARN_UNUSED_VARIABLE = YES;
395 | MACOSX_DEPLOYMENT_TARGET = 10.11;
396 | MTL_ENABLE_DEBUG_INFO = NO;
397 | SDKROOT = macosx;
398 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
399 | };
400 | name = Release;
401 | };
402 | A1417CBA1D19E833005DEFA3 /* Debug */ = {
403 | isa = XCBuildConfiguration;
404 | buildSettings = {
405 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
407 | CODE_SIGN_IDENTITY = "Mac Developer";
408 | COMBINE_HIDPI_IMAGES = YES;
409 | DEVELOPMENT_TEAM = 2EZDW5DVTJ;
410 | INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
412 | PRODUCT_BUNDLE_IDENTIFIER = org.vu0.ClangFormatter;
413 | PRODUCT_NAME = "$(TARGET_NAME)";
414 | SWIFT_VERSION = 3.0;
415 | };
416 | name = Debug;
417 | };
418 | A1417CBB1D19E833005DEFA3 /* Release */ = {
419 | isa = XCBuildConfiguration;
420 | buildSettings = {
421 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
422 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
423 | CODE_SIGN_IDENTITY = "Mac Developer";
424 | COMBINE_HIDPI_IMAGES = YES;
425 | DEVELOPMENT_TEAM = 2EZDW5DVTJ;
426 | INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
428 | PRODUCT_BUNDLE_IDENTIFIER = org.vu0.ClangFormatter;
429 | PRODUCT_NAME = "$(TARGET_NAME)";
430 | SWIFT_VERSION = 3.0;
431 | };
432 | name = Release;
433 | };
434 | A1417CD01D19EB7D005DEFA3 /* Debug */ = {
435 | isa = XCBuildConfiguration;
436 | buildSettings = {
437 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
438 | CODE_SIGN_ENTITLEMENTS = ClangFormat/ClangFormat.entitlements;
439 | CODE_SIGN_IDENTITY = "Mac Developer";
440 | COMBINE_HIDPI_IMAGES = YES;
441 | DEVELOPMENT_TEAM = 2EZDW5DVTJ;
442 | INFOPLIST_FILE = ClangFormat/Info.plist;
443 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks";
444 | MACOSX_DEPLOYMENT_TARGET = 10.11;
445 | PRODUCT_BUNDLE_IDENTIFIER = org.vu0.ClangFormatter.ClangFormat;
446 | PRODUCT_NAME = "$(TARGET_NAME)";
447 | SKIP_INSTALL = YES;
448 | SWIFT_VERSION = 3.0;
449 | };
450 | name = Debug;
451 | };
452 | A1417CD11D19EB7D005DEFA3 /* Release */ = {
453 | isa = XCBuildConfiguration;
454 | buildSettings = {
455 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
456 | CODE_SIGN_ENTITLEMENTS = ClangFormat/ClangFormat.entitlements;
457 | CODE_SIGN_IDENTITY = "Mac Developer";
458 | COMBINE_HIDPI_IMAGES = YES;
459 | DEVELOPMENT_TEAM = 2EZDW5DVTJ;
460 | INFOPLIST_FILE = ClangFormat/Info.plist;
461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks";
462 | MACOSX_DEPLOYMENT_TARGET = 10.11;
463 | PRODUCT_BUNDLE_IDENTIFIER = org.vu0.ClangFormatter.ClangFormat;
464 | PRODUCT_NAME = "$(TARGET_NAME)";
465 | SKIP_INSTALL = YES;
466 | SWIFT_VERSION = 3.0;
467 | };
468 | name = Release;
469 | };
470 | /* End XCBuildConfiguration section */
471 |
472 | /* Begin XCConfigurationList section */
473 | A1417CA71D19E832005DEFA3 /* Build configuration list for PBXProject "ClangFormatter" */ = {
474 | isa = XCConfigurationList;
475 | buildConfigurations = (
476 | A1417CB71D19E833005DEFA3 /* Debug */,
477 | A1417CB81D19E833005DEFA3 /* Release */,
478 | );
479 | defaultConfigurationIsVisible = 0;
480 | defaultConfigurationName = Release;
481 | };
482 | A1417CB91D19E833005DEFA3 /* Build configuration list for PBXNativeTarget "ClangFormatter" */ = {
483 | isa = XCConfigurationList;
484 | buildConfigurations = (
485 | A1417CBA1D19E833005DEFA3 /* Debug */,
486 | A1417CBB1D19E833005DEFA3 /* Release */,
487 | );
488 | defaultConfigurationIsVisible = 0;
489 | defaultConfigurationName = Release;
490 | };
491 | A1417CD21D19EB7D005DEFA3 /* Build configuration list for PBXNativeTarget "ClangFormat" */ = {
492 | isa = XCConfigurationList;
493 | buildConfigurations = (
494 | A1417CD01D19EB7D005DEFA3 /* Debug */,
495 | A1417CD11D19EB7D005DEFA3 /* Release */,
496 | );
497 | defaultConfigurationIsVisible = 0;
498 | defaultConfigurationName = Release;
499 | };
500 | /* End XCConfigurationList section */
501 | };
502 | rootObject = A1417CA41D19E832005DEFA3 /* Project object */;
503 | }
504 |
--------------------------------------------------------------------------------
/ClangFormatter.xcodeproj/xcshareddata/xcschemes/ClangFormat.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
16 |
22 |
23 |
24 |
30 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
69 |
73 |
74 |
75 |
81 |
82 |
83 |
84 |
85 |
86 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/ClangFormatter.xcodeproj/xcshareddata/xcschemes/ClangFormatter.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/Code/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // ClangFormatter
4 | //
5 | // Created by Boris Bügling on 21/06/16.
6 | // Copyright © 2016 🚀. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | @NSApplicationMain
12 | class AppDelegate: NSObject, NSApplicationDelegate {
13 | @IBOutlet weak var window: NSWindow!
14 |
15 | func applicationDidFinishLaunching(_ notification: Notification) {
16 | // Insert code here to initialize your application
17 | }
18 |
19 | func applicationWillTerminate(_ notification: Notification) {
20 | // Insert code here to tear down your application
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ClangFormat
2 | MVP of a ClangFormat Xcode Source Editor Extension.
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/Resources/Base.lproj/MainMenu.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
--------------------------------------------------------------------------------
/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | $(MACOSX_DEPLOYMENT_TARGET)
27 | NSHumanReadableCopyright
28 | Copyright © 2016 🚀. All rights reserved.
29 | NSMainNibFile
30 | MainMenu
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/bin/clang-format:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BalestraPatrick/ClangFormatter/991635808d3a5c4d5ed4c552cac37b6f7e0e460f/bin/clang-format
--------------------------------------------------------------------------------