├── .editorconfig ├── .gitignore ├── .gitmodules ├── EditorConfig.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── EditorConfig.xcscmblueprint └── xcshareddata │ └── xcschemes │ └── EditorConfig.xcscheme ├── EditorConfig ├── ECEditorConfigPlugin.h ├── ECEditorConfigPlugin.m ├── ECEditorConfigWrapper.h ├── ECEditorConfigWrapper.m ├── Info.plist ├── NSObject+PluginExtension.h └── NSObject+PluginExtension.m ├── LICENSE └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | [*{.h,.m,.mm}] 2 | indent_style = space 3 | indent_size = 2 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | xcuserdata 11 | *.xccheckout 12 | *.moved-aside 13 | DerivedData 14 | *.hmap 15 | *.ipa 16 | *.xcuserstate 17 | .DS_STORE 18 | .Trashes 19 | xcodebuild.log 20 | compile_commands.json 21 | .idea 22 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "EditorConfig/editorconfig-core-c"] 2 | path = EditorConfig/editorconfig-core-c 3 | url = git@github.com:editorconfig/editorconfig-core-c.git 4 | -------------------------------------------------------------------------------- /EditorConfig.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A93163A01B1D887D00C3140F /* ECEditorConfigWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = A931639F1B1D887D00C3140F /* ECEditorConfigWrapper.m */; }; 11 | A9D230611B1C5F940099FB45 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D230601B1C5F940099FB45 /* AppKit.framework */; }; 12 | A9D230631B1C5F940099FB45 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D230621B1C5F940099FB45 /* Foundation.framework */; }; 13 | A9D230681B1C5F940099FB45 /* EditorConfig.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = A9D230671B1C5F940099FB45 /* EditorConfig.xcscheme */; }; 14 | A9D2306B1B1C5F940099FB45 /* ECEditorConfigPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D2306A1B1C5F940099FB45 /* ECEditorConfigPlugin.m */; }; 15 | A9D2306E1B1C5F940099FB45 /* NSObject+PluginExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D2306D1B1C5F940099FB45 /* NSObject+PluginExtension.m */; }; 16 | A9F5388C1B1EE7D7009F5968 /* libeditorconfig_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9F5388B1B1EE7D7009F5968 /* libeditorconfig_static.a */; }; 17 | A9FF33561B1C93D600E67E94 /* libpcre.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A9FF33551B1C93D600E67E94 /* libpcre.dylib */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 4EA1468302B0E107C69C9AC4 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | A931639E1B1D887D00C3140F /* ECEditorConfigWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECEditorConfigWrapper.h; sourceTree = ""; }; 23 | A931639F1B1D887D00C3140F /* ECEditorConfigWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ECEditorConfigWrapper.m; sourceTree = ""; }; 24 | A9D2305D1B1C5F940099FB45 /* EditorConfig.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EditorConfig.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | A9D230601B1C5F940099FB45 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 26 | A9D230621B1C5F940099FB45 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 27 | A9D230661B1C5F940099FB45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | A9D230671B1C5F940099FB45 /* EditorConfig.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = EditorConfig.xcscheme; path = EditorConfig.xcodeproj/xcshareddata/xcschemes/EditorConfig.xcscheme; sourceTree = SOURCE_ROOT; }; 29 | A9D230691B1C5F940099FB45 /* ECEditorConfigPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ECEditorConfigPlugin.h; sourceTree = ""; }; 30 | A9D2306A1B1C5F940099FB45 /* ECEditorConfigPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ECEditorConfigPlugin.m; sourceTree = ""; }; 31 | A9D2306C1B1C5F940099FB45 /* NSObject+PluginExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+PluginExtension.h"; sourceTree = ""; }; 32 | A9D2306D1B1C5F940099FB45 /* NSObject+PluginExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+PluginExtension.m"; sourceTree = ""; }; 33 | A9F5388B1B1EE7D7009F5968 /* libeditorconfig_static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libeditorconfig_static.a; path = "editorconfig-core-c/lib/libeditorconfig_static.a"; sourceTree = ""; }; 34 | A9F5388D1B1EE7E3009F5968 /* editorconfig_handle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = editorconfig_handle.h; path = "editorconfig-core-c/include/editorconfig/editorconfig_handle.h"; sourceTree = ""; }; 35 | A9F5388E1B1EE7E3009F5968 /* editorconfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = editorconfig.h; path = "editorconfig-core-c/include/editorconfig/editorconfig.h"; sourceTree = ""; }; 36 | A9FF33551B1C93D600E67E94 /* libpcre.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpcre.dylib; path = usr/lib/libpcre.dylib; sourceTree = SDKROOT; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | A9D2305B1B1C5F940099FB45 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | A9FF33561B1C93D600E67E94 /* libpcre.dylib in Frameworks */, 45 | A9D230611B1C5F940099FB45 /* AppKit.framework in Frameworks */, 46 | A9F5388C1B1EE7D7009F5968 /* libeditorconfig_static.a in Frameworks */, 47 | A9D230631B1C5F940099FB45 /* Foundation.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | A9D230541B1C5F940099FB45 = { 55 | isa = PBXGroup; 56 | children = ( 57 | A9D230641B1C5F940099FB45 /* EditorConfig */, 58 | A9D2305F1B1C5F940099FB45 /* Frameworks */, 59 | A9D2305E1B1C5F940099FB45 /* Products */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | A9D2305E1B1C5F940099FB45 /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | A9D2305D1B1C5F940099FB45 /* EditorConfig.xcplugin */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | A9D2305F1B1C5F940099FB45 /* Frameworks */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | A9FF33551B1C93D600E67E94 /* libpcre.dylib */, 75 | A9D230601B1C5F940099FB45 /* AppKit.framework */, 76 | A9D230621B1C5F940099FB45 /* Foundation.framework */, 77 | 4EA1468302B0E107C69C9AC4 /* libPods.a */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | A9D230641B1C5F940099FB45 /* EditorConfig */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | A9F5388A1B1EE7C8009F5968 /* libeditorconfig */, 86 | A9D230691B1C5F940099FB45 /* ECEditorConfigPlugin.h */, 87 | A9D2306A1B1C5F940099FB45 /* ECEditorConfigPlugin.m */, 88 | A9D2306C1B1C5F940099FB45 /* NSObject+PluginExtension.h */, 89 | A9D2306D1B1C5F940099FB45 /* NSObject+PluginExtension.m */, 90 | A931639E1B1D887D00C3140F /* ECEditorConfigWrapper.h */, 91 | A931639F1B1D887D00C3140F /* ECEditorConfigWrapper.m */, 92 | A9D230651B1C5F940099FB45 /* Supporting Files */, 93 | ); 94 | path = EditorConfig; 95 | sourceTree = ""; 96 | }; 97 | A9D230651B1C5F940099FB45 /* Supporting Files */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | A9D230661B1C5F940099FB45 /* Info.plist */, 101 | A9D230671B1C5F940099FB45 /* EditorConfig.xcscheme */, 102 | ); 103 | name = "Supporting Files"; 104 | sourceTree = ""; 105 | }; 106 | A9F5388A1B1EE7C8009F5968 /* libeditorconfig */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | A9F5388D1B1EE7E3009F5968 /* editorconfig_handle.h */, 110 | A9F5388E1B1EE7E3009F5968 /* editorconfig.h */, 111 | A9F5388B1B1EE7D7009F5968 /* libeditorconfig_static.a */, 112 | ); 113 | name = libeditorconfig; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | A9D2305C1B1C5F940099FB45 /* EditorConfig */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = A9D230711B1C5F940099FB45 /* Build configuration list for PBXNativeTarget "EditorConfig" */; 122 | buildPhases = ( 123 | A9F5388F1B1EE987009F5968 /* Compile editorconfig-core-c */, 124 | A9D230591B1C5F940099FB45 /* Sources */, 125 | A9D2305A1B1C5F940099FB45 /* Resources */, 126 | A9D2305B1B1C5F940099FB45 /* Frameworks */, 127 | ); 128 | buildRules = ( 129 | ); 130 | dependencies = ( 131 | ); 132 | name = EditorConfig; 133 | productName = EditorConfig; 134 | productReference = A9D2305D1B1C5F940099FB45 /* EditorConfig.xcplugin */; 135 | productType = "com.apple.product-type.bundle"; 136 | }; 137 | /* End PBXNativeTarget section */ 138 | 139 | /* Begin PBXProject section */ 140 | A9D230551B1C5F940099FB45 /* Project object */ = { 141 | isa = PBXProject; 142 | attributes = { 143 | LastUpgradeCheck = 0630; 144 | ORGANIZATIONNAME = "Marco Sero"; 145 | TargetAttributes = { 146 | A9D2305C1B1C5F940099FB45 = { 147 | CreatedOnToolsVersion = 6.3.2; 148 | }; 149 | }; 150 | }; 151 | buildConfigurationList = A9D230581B1C5F940099FB45 /* Build configuration list for PBXProject "EditorConfig" */; 152 | compatibilityVersion = "Xcode 3.2"; 153 | developmentRegion = English; 154 | hasScannedForEncodings = 0; 155 | knownRegions = ( 156 | en, 157 | ); 158 | mainGroup = A9D230541B1C5F940099FB45; 159 | productRefGroup = A9D2305E1B1C5F940099FB45 /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | A9D2305C1B1C5F940099FB45 /* EditorConfig */, 164 | ); 165 | }; 166 | /* End PBXProject section */ 167 | 168 | /* Begin PBXResourcesBuildPhase section */ 169 | A9D2305A1B1C5F940099FB45 /* Resources */ = { 170 | isa = PBXResourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | A9D230681B1C5F940099FB45 /* EditorConfig.xcscheme in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | A9F5388F1B1EE987009F5968 /* Compile editorconfig-core-c */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Compile editorconfig-core-c"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "export PATH=/usr/local/bin:$PATH\n\ncd \"$PROJECT_DIR\"/EditorConfig/editorconfig-core-c\ncmake .\nmake install\n"; 193 | }; 194 | /* End PBXShellScriptBuildPhase section */ 195 | 196 | /* Begin PBXSourcesBuildPhase section */ 197 | A9D230591B1C5F940099FB45 /* Sources */ = { 198 | isa = PBXSourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | A9D2306B1B1C5F940099FB45 /* ECEditorConfigPlugin.m in Sources */, 202 | A9D2306E1B1C5F940099FB45 /* NSObject+PluginExtension.m in Sources */, 203 | A93163A01B1D887D00C3140F /* ECEditorConfigWrapper.m in Sources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin XCBuildConfiguration section */ 210 | A9D2306F1B1C5F940099FB45 /* Debug */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 215 | CLANG_CXX_LIBRARY = "libc++"; 216 | CLANG_ENABLE_MODULES = YES; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | CLANG_WARN_BOOL_CONVERSION = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_UNREACHABLE_CODE = YES; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | COPY_PHASE_STRIP = NO; 228 | ENABLE_STRICT_OBJC_MSGSEND = YES; 229 | GCC_C_LANGUAGE_STANDARD = gnu99; 230 | GCC_DYNAMIC_NO_PIC = NO; 231 | GCC_NO_COMMON_BLOCKS = YES; 232 | GCC_OPTIMIZATION_LEVEL = 0; 233 | GCC_PREPROCESSOR_DEFINITIONS = ( 234 | "DEBUG=1", 235 | "$(inherited)", 236 | ); 237 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 238 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 239 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 240 | GCC_WARN_UNDECLARED_SELECTOR = YES; 241 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 242 | GCC_WARN_UNUSED_FUNCTION = YES; 243 | GCC_WARN_UNUSED_VARIABLE = YES; 244 | MTL_ENABLE_DEBUG_INFO = YES; 245 | ONLY_ACTIVE_ARCH = YES; 246 | }; 247 | name = Debug; 248 | }; 249 | A9D230701B1C5F940099FB45 /* Release */ = { 250 | isa = XCBuildConfiguration; 251 | buildSettings = { 252 | ALWAYS_SEARCH_USER_PATHS = NO; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 254 | CLANG_CXX_LIBRARY = "libc++"; 255 | CLANG_ENABLE_MODULES = YES; 256 | CLANG_ENABLE_OBJC_ARC = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_CONSTANT_CONVERSION = YES; 259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 264 | CLANG_WARN_UNREACHABLE_CODE = YES; 265 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 266 | COPY_PHASE_STRIP = NO; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | MTL_ENABLE_DEBUG_INFO = NO; 278 | }; 279 | name = Release; 280 | }; 281 | A9D230721B1C5F940099FB45 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = YES; 285 | COMBINE_HIDPI_IMAGES = YES; 286 | DEPLOYMENT_LOCATION = YES; 287 | DSTROOT = "$(HOME)"; 288 | HEADER_SEARCH_PATHS = ( 289 | "$(inherited)", 290 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 291 | "$(PROJECT_DIR)/EditorConfig/editorconfig-core-c/include", 292 | ); 293 | INFOPLIST_FILE = EditorConfig/Info.plist; 294 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 295 | LIBRARY_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "$(PROJECT_DIR)/EditorConfig", 298 | "$(PROJECT_DIR)/EditorConfig/editorconfig-core-c/lib", 299 | ); 300 | MACOSX_DEPLOYMENT_TARGET = 10.10; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | USER_HEADER_SEARCH_PATHS = ""; 303 | WRAPPER_EXTENSION = xcplugin; 304 | }; 305 | name = Debug; 306 | }; 307 | A9D230731B1C5F940099FB45 /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = YES; 311 | COMBINE_HIDPI_IMAGES = YES; 312 | DEPLOYMENT_LOCATION = YES; 313 | DSTROOT = "$(HOME)"; 314 | HEADER_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 317 | "$(PROJECT_DIR)/EditorConfig/editorconfig-core-c/include", 318 | ); 319 | INFOPLIST_FILE = EditorConfig/Info.plist; 320 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 321 | LIBRARY_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "$(PROJECT_DIR)/EditorConfig", 324 | "$(PROJECT_DIR)/EditorConfig/editorconfig-core-c/lib", 325 | ); 326 | MACOSX_DEPLOYMENT_TARGET = 10.10; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | USER_HEADER_SEARCH_PATHS = ""; 329 | WRAPPER_EXTENSION = xcplugin; 330 | }; 331 | name = Release; 332 | }; 333 | /* End XCBuildConfiguration section */ 334 | 335 | /* Begin XCConfigurationList section */ 336 | A9D230581B1C5F940099FB45 /* Build configuration list for PBXProject "EditorConfig" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | A9D2306F1B1C5F940099FB45 /* Debug */, 340 | A9D230701B1C5F940099FB45 /* Release */, 341 | ); 342 | defaultConfigurationIsVisible = 0; 343 | defaultConfigurationName = Release; 344 | }; 345 | A9D230711B1C5F940099FB45 /* Build configuration list for PBXNativeTarget "EditorConfig" */ = { 346 | isa = XCConfigurationList; 347 | buildConfigurations = ( 348 | A9D230721B1C5F940099FB45 /* Debug */, 349 | A9D230731B1C5F940099FB45 /* Release */, 350 | ); 351 | defaultConfigurationIsVisible = 0; 352 | defaultConfigurationName = Release; 353 | }; 354 | /* End XCConfigurationList section */ 355 | }; 356 | rootObject = A9D230551B1C5F940099FB45 /* Project object */; 357 | } 358 | -------------------------------------------------------------------------------- /EditorConfig.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EditorConfig.xcodeproj/project.xcworkspace/xcshareddata/EditorConfig.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "0A61B5586F9384D1F52FBD946E8F3FDE0B5303E7", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "0A61B5586F9384D1F52FBD946E8F3FDE0B5303E7" : 0, 8 | "B8BB332BF7FB412704858443286205D5046632C6" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "EC0E2388-DE1D-45BE-953D-65C441256B30", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "0A61B5586F9384D1F52FBD946E8F3FDE0B5303E7" : "EditorConfig-Xcode-Plugin", 13 | "B8BB332BF7FB412704858443286205D5046632C6" : "EditorConfig-Xcode-PluginEditorConfig\/editorconfig-core-c" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "EditorConfig", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 203, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "EditorConfig.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:MarcoSero\/EditorConfig-Xcode.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0A61B5586F9384D1F52FBD946E8F3FDE0B5303E7" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:editorconfig\/editorconfig-core-c.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "B8BB332BF7FB412704858443286205D5046632C6" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /EditorConfig.xcodeproj/xcshareddata/xcschemes/EditorConfig.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 42 | 46 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 68 | 69 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /EditorConfig/ECEditorConfigPlugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // EditorConfig.h 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 01/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define ECLog(fmt, ...) NSLog((@"EditorConfigPlugin | %s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 12 | 13 | @class ECEditorConfigPlugin; 14 | 15 | static ECEditorConfigPlugin *sharedPlugin; 16 | 17 | @interface ECEditorConfigPlugin : NSObject 18 | 19 | @property (nonatomic, strong, readonly) NSBundle* bundle; 20 | 21 | + (instancetype)sharedPlugin; 22 | 23 | - (id)initWithBundle:(NSBundle *)plugin; 24 | 25 | @end -------------------------------------------------------------------------------- /EditorConfig/ECEditorConfigPlugin.m: -------------------------------------------------------------------------------- 1 | // 2 | // EditorConfig.m 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 01/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | #import "ECEditorConfigPlugin.h" 10 | #import "ECEditorConfigWrapper.h" 11 | 12 | static NSString *IDEEditorDocumentDidChangeNotification = @"IDEEditorDocumentDidChangeNotification"; 13 | 14 | @interface ECEditorConfigPlugin () 15 | @property (nonatomic, strong, readwrite) NSBundle *bundle; 16 | @property (nonatomic, strong) dispatch_queue_t updateSettingsQueue; 17 | @end 18 | 19 | @implementation ECEditorConfigPlugin 20 | 21 | + (instancetype)sharedPlugin 22 | { 23 | return sharedPlugin; 24 | } 25 | 26 | - (id)initWithBundle:(NSBundle *)plugin 27 | { 28 | self = [super init]; 29 | if (!self) { 30 | return nil; 31 | } 32 | _bundle = plugin; 33 | _updateSettingsQueue = dispatch_queue_create("com.marcosero.EditorConfig.queue", DISPATCH_QUEUE_SERIAL); 34 | [[NSNotificationCenter defaultCenter] addObserver:self 35 | selector:@selector(onFileChangeNotification:) 36 | name:IDEEditorDocumentDidChangeNotification 37 | object:nil]; 38 | return self; 39 | } 40 | 41 | - (void)dealloc 42 | { 43 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 44 | } 45 | 46 | - (void)onFileChangeNotification:(NSNotification *)notification 47 | { 48 | NSDocument *currentDocument = notification.object; 49 | if (![currentDocument respondsToSelector:@selector(fileURL)]) { 50 | return; 51 | } 52 | dispatch_async(self.updateSettingsQueue, ^{ 53 | [self updateSettingsForFileURL:currentDocument.fileURL]; 54 | }); 55 | } 56 | 57 | - (void)updateSettingsForFileURL:(NSURL *)fileURL 58 | { 59 | NSDictionary *editorConfig = [ECEditorConfigWrapper editorConfigurationForFileURL:fileURL]; 60 | 61 | if (editorConfig[ECIndentSizeKey]) { 62 | [[NSUserDefaults standardUserDefaults] setObject:editorConfig[ECIndentSizeKey] forKey:@"DVTTextIndentWidth"]; 63 | } 64 | 65 | if (editorConfig[ECTabWidthKey]) { 66 | [[NSUserDefaults standardUserDefaults] setObject:editorConfig[ECTabWidthKey] forKey:@"DVTTextIndentTabWidth"]; 67 | } 68 | 69 | if (editorConfig[ECIndentStyleKey]) { 70 | BOOL indentUsingTabs = [editorConfig[ECIndentStyleKey] isEqualToString:@"tab"]; 71 | [[NSUserDefaults standardUserDefaults] setObject:@(indentUsingTabs) forKey:@"DVTTextIndentUsingTabs"]; 72 | } 73 | 74 | [[NSUserDefaults standardUserDefaults] synchronize]; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /EditorConfig/ECEditorConfigWrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // ECEditorConfigWrapper.h 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 02/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ECEditorConfigPlugin.h" 11 | 12 | FOUNDATION_EXPORT NSString *const ECIndentStyleKey; 13 | FOUNDATION_EXPORT NSString *const ECIndentSizeKey; 14 | FOUNDATION_EXPORT NSString *const ECTabWidthKey; 15 | 16 | @interface ECEditorConfigWrapper : NSObject 17 | 18 | + (NSDictionary *)editorConfigurationForFileURL:(NSURL *)fileURL; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /EditorConfig/ECEditorConfigWrapper.m: -------------------------------------------------------------------------------- 1 | // 2 | // ECEditorConfigWrapper.m 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 02/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | #import "ECEditorConfigWrapper.h" 10 | #import 11 | 12 | NSString *const ECIndentStyleKey = @"indent_style"; 13 | NSString *const ECIndentSizeKey = @"indent_size"; 14 | NSString *const ECTabWidthKey = @"tab_width"; 15 | 16 | @implementation ECEditorConfigWrapper 17 | 18 | + (NSDictionary *)editorConfigurationForFileURL:(NSURL *)fileURL 19 | { 20 | if (!fileURL) { 21 | ECLog(@"No file URL"); 22 | return nil; 23 | } 24 | 25 | editorconfig_handle eh = editorconfig_handle_init(); 26 | 27 | const char *filepath = fileURL.fileSystemRepresentation; 28 | int err_num = editorconfig_parse(filepath, eh); 29 | 30 | if (err_num != 0) { 31 | ECLog(@"%s", editorconfig_get_error_msg(err_num)); 32 | if (err_num > 0) { 33 | ECLog(@"%s", editorconfig_handle_get_err_file(eh)); 34 | } 35 | return nil; 36 | } 37 | 38 | NSMutableDictionary *config = [NSMutableDictionary dictionary]; 39 | int name_value_count = editorconfig_handle_get_name_value_count(eh); 40 | for (int j = 0; j < name_value_count; ++j) { 41 | const char *name; 42 | const char *value; 43 | editorconfig_handle_get_name_value(eh, j, &name, &value); 44 | config[[NSString stringWithUTF8String:name]] = [NSString stringWithUTF8String:value]; 45 | } 46 | 47 | if (editorconfig_handle_destroy(eh) != 0) { 48 | ECLog(@"Failed to destroy editorconfig_handle."); 49 | } 50 | return config; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /EditorConfig/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.marcosero.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 28 | F41BD31E-2683-44B8-AE7F-5F09E919790E 29 | C4A681B0-4A26-480E-93EC-1218098B9AA0 30 | AD68E85B-441B-4301-B564-A45E4919A6AD 31 | A16FF353-8441-459E-A50C-B071F53F51B7 32 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 33 | E969541F-E6F9-4D25-8158-72DC3545A6C6 34 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 35 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 36 | 37 | LSMinimumSystemVersion 38 | $(MACOSX_DEPLOYMENT_TARGET) 39 | NSPrincipalClass 40 | EditorConfig 41 | XC4Compatible 42 | 43 | XCPluginHasUI 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /EditorConfig/NSObject+PluginExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.h 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 01/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (Xcode_Plugin_Template_Extension) 12 | 13 | + (void)pluginDidLoad:(NSBundle *)plugin; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /EditorConfig/NSObject+PluginExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.m 3 | // EditorConfig 4 | // 5 | // Created by Marco Sero on 01/06/2015. 6 | // Copyright (c) 2015 Marco Sero. All rights reserved. 7 | // 8 | 9 | 10 | #import "NSObject+PluginExtension.h" 11 | #import "ECEditorConfigPlugin.h" 12 | 13 | @implementation NSObject (Xcode_Plugin_Template_Extension) 14 | 15 | + (void)pluginDidLoad:(NSBundle *)plugin 16 | { 17 | static dispatch_once_t onceToken; 18 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 19 | if ([currentApplicationName isEqual:@"Xcode"]) { 20 | dispatch_once(&onceToken, ^{ 21 | sharedPlugin = [[ECEditorConfigPlugin alloc] initWithBundle:plugin]; 22 | }); 23 | } 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marco Sero 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 | # EditorConfig Xcode Plugin 2 | 3 | Plugin to add [EditorConfig](http://editorconfig.org) support to Xcode. 4 | 5 | ## What is EditorConfig 6 | 7 | > EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems. 8 | 9 | For more info, head to [http://editorconfig.org](http://editorconfig.org) 10 | 11 | ## What this plugin does 12 | When opening a file, the plugin looks for a file named `.editorconfig` in the directory of the opened file and in every parent directory. 13 | Once the file is found, the coding styles for the file extension will be read and the plugin will dynamically change the Xcode settings to match the style. 14 | 15 | This is particularly useful in different scenarios: 16 | 17 | - When contributing to a project which has a different style guide from what you normally use, you can just use a different `.editorconfig` to override the default settings. 18 | - If you like having different indentation settings for different languages (e.g. Objective-C and Swift). 19 | - You prefer your indentation settings to be editor-agnostic. 20 | 21 | ## Install 22 | Install via [Alcatraz](http://alcatraz.io). Just search for “EditorConfig”. 23 | 24 | ## Settings currently supported 25 | - `indent_style` 26 | - `indent_size` 27 | - `tab_width` 28 | 29 | ## How this is different from ClangFormat 30 | ClangFormat is a much more powerful tool, but it can be overkill for simply changing indentation settings. 31 | 32 | ## Contact 33 | [marcosero.com](http://www.marcosero.com) 34 | [@marcosero](http://twitter.com/marcosero) 35 | 36 | ## License 37 | MIT --------------------------------------------------------------------------------