├── .gitignore ├── README.md ├── SCXcodeSwitchExpander.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── SCXcodeSwitchExpander.xcscheme └── SCXcodeSwitchExpander ├── DVTSourceCodeLanguage+SCXCodeSwitchExpander.h ├── DVTSourceCodeLanguage+SCXCodeSwitchExpander.m ├── DVTTextCompletionController+SCXcodeSwitchExpander.h ├── DVTTextCompletionController+SCXcodeSwitchExpander.m ├── DVTTextCompletionSession+SCXcodeSwitchExpander.h ├── DVTTextCompletionSession+SCXcodeSwitchExpander.m ├── SCXcodeSwitchExpander-Info.plist ├── SCXcodeSwitchExpander-Prefix.pch ├── SCXcodeSwitchExpander.h ├── SCXcodeSwitchExpander.m └── Xcode Headers ├── DVTCompletingTextView.h ├── DVTSourceCodeLanguage.h ├── DVTSourceCodeSymbolKind.h ├── DVTSourceTextView.h ├── DVTTextCompletionController.h ├── DVTTextCompletionListWindowController.h ├── DVTTextCompletionSession.h ├── DVTTextStorage.h ├── DVTViewController.h ├── IDEEditor.h ├── IDEFileTextSettings.h ├── IDEIndex.h ├── IDEIndexClassSymbol.h ├── IDEIndexCollection.h ├── IDEIndexCompletionItem.h ├── IDEIndexContainerSymbol.h ├── IDEIndexSymbol.h └── IDEWorkspace.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SCXcodeSwitchExpander 2 | 3 | SCXcodeSwitchExpander is a small Xcode plugin that expands switch statements by inserting missing cases. 4 | 5 | ### Features 6 | 7 | - inserts all possible switch cases 8 | 9 | - keeps already used cases and only inserts missing ones (even if the type changes) 10 | 11 | - only keeps the 'default:' case when used with the built-in Xcode snippet 12 | 13 | - works on ivars, properties, method parameters etc. 14 | 15 | - works with nested switches 16 | 17 | - hooks into the undo manager stack (makes it easier to fix typos) 18 | 19 | - fast and reliable (won't affect Xcode's performance in any signinficant way) 20 | 21 | ### Screenshots 22 | 23 | - Replacing the default Xcode snippet 24 | ![DefaultSnippet](https://drive.google.com/u/0/uc?id=1PnLNhEUDggrjOQ7cAXHu9v9fVVoIDKAa&export=download) 25 | 26 | - Inserting missing cases 27 | ![MissingInsertion](https://drive.google.com/u/0/uc?id=12rdzUB0UwMzV-P5CWkAlTvhkvIIDgax2&export=download) 28 | 29 | ### Known Issues 30 | 31 | - takes a bit for it to kick in after starting Xcode as it's waiting for the IDEIndexDidChange notification. I found that building the project usually makes that happen. 32 | 33 | - does not work with anonymous enums 34 | 35 | ### Installation 36 | 37 | - Build the project and restart Xcode or ... 38 | 39 | - Download SCXcodeSwitchExpander.xcplugin.zip from the releases tab, unzip and move it to the Xcode plugins folder ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SCXcodeSwitchExpander.xcplugin and restart Xcode or ... 40 | 41 | - Get it through [Alcatraz](https://github.com/alcatraz/Alcatraz) 42 | 43 | - If you encounter any issues you can uninstall it by removing the ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SCXcodeSwitchExpander.xcplugin folder 44 | 45 | ### Contact 46 | Any suggestions or improvements are more than welcome. Feel free to contact me at [stefan.ceriu@gmail.com](mailto:stefan.ceriu@gmail.com) or [@stefanceriu](https://twitter.com/stefanceriu). 47 | 48 | 49 | ### License 50 | 51 | MIT License 52 | 53 | Copyright (c) 2014 Stefan Ceriu 54 | 55 | Permission is hereby granted, free of charge, to any person obtaining a copy of 56 | this software and associated documentation files (the "Software"), to deal in 57 | the Software without restriction, including without limitation the rights to use, 58 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 59 | Software, and to permit persons to whom the Software is furnished to do so, 60 | subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all 63 | copies or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 67 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 68 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 69 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 70 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 71 | 72 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1821147F18DDABF8005F1C26 /* IDEKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1821147E18DDABF8005F1C26 /* IDEKit.framework */; }; 11 | 1830652818D268E50001DC8E /* DVTFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1830652718D268E50001DC8E /* DVTFoundation.framework */; }; 12 | 1830652A18D268FE0001DC8E /* DVTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1830652918D268FE0001DC8E /* DVTKit.framework */; }; 13 | 18990B3618D2529C007A8756 /* SCXcodeSwitchExpander.m in Sources */ = {isa = PBXBuildFile; fileRef = 18990B3518D2529C007A8756 /* SCXcodeSwitchExpander.m */; }; 14 | 18A1B48118DDA742007CA06A /* IDEFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18A1B48018DDA742007CA06A /* IDEFoundation.framework */; }; 15 | 18ECEB5718D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.m in Sources */ = {isa = PBXBuildFile; fileRef = 18ECEB5618D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.m */; }; 16 | B150FD8A1CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.m in Sources */ = {isa = PBXBuildFile; fileRef = B150FD891CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.m */; }; 17 | B18173D81CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.m in Sources */ = {isa = PBXBuildFile; fileRef = B18173D71CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 0144D9921B06F9F00012D7A2 /* DVTCompletingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTCompletingTextView.h; sourceTree = ""; }; 22 | 0144D9971B06F9F00012D7A2 /* DVTSourceCodeSymbolKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceCodeSymbolKind.h; sourceTree = ""; }; 23 | 0144D9991B06F9F00012D7A2 /* DVTSourceTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTSourceTextView.h; sourceTree = ""; }; 24 | 0144D99A1B06F9F00012D7A2 /* DVTTextCompletionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTTextCompletionController.h; sourceTree = ""; }; 25 | 0144D99B1B06F9F00012D7A2 /* DVTTextCompletionListWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTTextCompletionListWindowController.h; sourceTree = ""; }; 26 | 0144D99C1B06F9F00012D7A2 /* DVTTextCompletionSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTTextCompletionSession.h; sourceTree = ""; }; 27 | 0144D99F1B06F9F00012D7A2 /* IDEEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEEditor.h; sourceTree = ""; }; 28 | 0144D9A01B06F9F00012D7A2 /* IDEIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndex.h; sourceTree = ""; }; 29 | 0144D9A11B06F9F00012D7A2 /* IDEIndexCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndexCollection.h; sourceTree = ""; }; 30 | 0144D9A21B06F9F00012D7A2 /* IDEIndexCompletionItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndexCompletionItem.h; sourceTree = ""; }; 31 | 0144D9A31B06F9F00012D7A2 /* IDEIndexContainerSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndexContainerSymbol.h; sourceTree = ""; }; 32 | 0144D9A61B06F9F00012D7A2 /* IDEIndexSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndexSymbol.h; sourceTree = ""; }; 33 | 0144D9B11B06FBD30012D7A2 /* IDEFileTextSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEFileTextSettings.h; sourceTree = ""; }; 34 | 1821147E18DDABF8005F1C26 /* IDEKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IDEKit.framework; path = ../../../../Applications/Xcode.app/Contents/Frameworks/IDEKit.framework; sourceTree = ""; }; 35 | 1830652718D268E50001DC8E /* DVTFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVTFoundation.framework; path = ../../../../Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework; sourceTree = ""; }; 36 | 1830652918D268FE0001DC8E /* DVTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DVTKit.framework; path = ../../../../Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework; sourceTree = ""; }; 37 | 185293151B085C4200A2E2C7 /* DVTViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVTViewController.h; sourceTree = ""; }; 38 | 18990B1F18D25239007A8756 /* SCXcodeSwitchExpander.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCXcodeSwitchExpander.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 18990B2A18D25239007A8756 /* SCXcodeSwitchExpander-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCXcodeSwitchExpander-Info.plist"; sourceTree = ""; }; 40 | 18990B2E18D25239007A8756 /* SCXcodeSwitchExpander-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCXcodeSwitchExpander-Prefix.pch"; sourceTree = ""; }; 41 | 18990B3418D2529C007A8756 /* SCXcodeSwitchExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCXcodeSwitchExpander.h; sourceTree = ""; }; 42 | 18990B3518D2529C007A8756 /* SCXcodeSwitchExpander.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCXcodeSwitchExpander.m; sourceTree = ""; }; 43 | 18A1B48018DDA742007CA06A /* IDEFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IDEFoundation.framework; path = ../../../../Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework; sourceTree = ""; }; 44 | 18ECEB5518D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DVTTextCompletionController+SCXcodeSwitchExpander.h"; sourceTree = ""; }; 45 | 18ECEB5618D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DVTTextCompletionController+SCXcodeSwitchExpander.m"; sourceTree = ""; }; 46 | B127B27A1CBBDDE000E32C2B /* IDEIndexClassSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDEIndexClassSymbol.h; sourceTree = ""; }; 47 | B150FD881CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DVTTextCompletionSession+SCXcodeSwitchExpander.h"; sourceTree = ""; }; 48 | B150FD891CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DVTTextCompletionSession+SCXcodeSwitchExpander.m"; sourceTree = ""; }; 49 | B18173D61CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DVTSourceCodeLanguage+SCXCodeSwitchExpander.h"; sourceTree = ""; }; 50 | B18173D71CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DVTSourceCodeLanguage+SCXCodeSwitchExpander.m"; sourceTree = ""; }; 51 | B18173D91CBB92C700995105 /* DVTSourceCodeLanguage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DVTSourceCodeLanguage.h; sourceTree = ""; }; 52 | B18173DA1CBB958300995105 /* DVTTextStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DVTTextStorage.h; sourceTree = ""; }; 53 | B1F83C551CB9090F00843242 /* IDEWorkspace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IDEWorkspace.h; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 18990B1C18D25239007A8756 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 18A1B48118DDA742007CA06A /* IDEFoundation.framework in Frameworks */, 62 | 1830652A18D268FE0001DC8E /* DVTKit.framework in Frameworks */, 63 | 1821147F18DDABF8005F1C26 /* IDEKit.framework in Frameworks */, 64 | 1830652818D268E50001DC8E /* DVTFoundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 18142E1D18E89497006BD329 /* Xcode Headers */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 0144D9921B06F9F00012D7A2 /* DVTCompletingTextView.h */, 75 | B18173D91CBB92C700995105 /* DVTSourceCodeLanguage.h */, 76 | 0144D9971B06F9F00012D7A2 /* DVTSourceCodeSymbolKind.h */, 77 | 0144D9991B06F9F00012D7A2 /* DVTSourceTextView.h */, 78 | 0144D99A1B06F9F00012D7A2 /* DVTTextCompletionController.h */, 79 | 0144D99B1B06F9F00012D7A2 /* DVTTextCompletionListWindowController.h */, 80 | 0144D99C1B06F9F00012D7A2 /* DVTTextCompletionSession.h */, 81 | B18173DA1CBB958300995105 /* DVTTextStorage.h */, 82 | 185293151B085C4200A2E2C7 /* DVTViewController.h */, 83 | 0144D99F1B06F9F00012D7A2 /* IDEEditor.h */, 84 | 0144D9B11B06FBD30012D7A2 /* IDEFileTextSettings.h */, 85 | 0144D9A01B06F9F00012D7A2 /* IDEIndex.h */, 86 | B127B27A1CBBDDE000E32C2B /* IDEIndexClassSymbol.h */, 87 | 0144D9A11B06F9F00012D7A2 /* IDEIndexCollection.h */, 88 | 0144D9A21B06F9F00012D7A2 /* IDEIndexCompletionItem.h */, 89 | 0144D9A31B06F9F00012D7A2 /* IDEIndexContainerSymbol.h */, 90 | 0144D9A61B06F9F00012D7A2 /* IDEIndexSymbol.h */, 91 | B1F83C551CB9090F00843242 /* IDEWorkspace.h */, 92 | ); 93 | path = "Xcode Headers"; 94 | sourceTree = ""; 95 | }; 96 | 18990B1618D25239007A8756 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 18990B2818D25239007A8756 /* SCXcodeSwitchExpander */, 100 | 18990B2118D25239007A8756 /* Frameworks */, 101 | 18990B2018D25239007A8756 /* Products */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 18990B2018D25239007A8756 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 18990B1F18D25239007A8756 /* SCXcodeSwitchExpander.xcplugin */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 18990B2118D25239007A8756 /* Frameworks */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 1830652718D268E50001DC8E /* DVTFoundation.framework */, 117 | 1830652918D268FE0001DC8E /* DVTKit.framework */, 118 | 18A1B48018DDA742007CA06A /* IDEFoundation.framework */, 119 | 1821147E18DDABF8005F1C26 /* IDEKit.framework */, 120 | ); 121 | name = Frameworks; 122 | sourceTree = ""; 123 | }; 124 | 18990B2818D25239007A8756 /* SCXcodeSwitchExpander */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 18990B3418D2529C007A8756 /* SCXcodeSwitchExpander.h */, 128 | 18990B3518D2529C007A8756 /* SCXcodeSwitchExpander.m */, 129 | 18ECEB5518D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.h */, 130 | 18ECEB5618D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.m */, 131 | B150FD881CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.h */, 132 | B150FD891CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.m */, 133 | B18173D61CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.h */, 134 | B18173D71CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.m */, 135 | 18142E1D18E89497006BD329 /* Xcode Headers */, 136 | 18990B2918D25239007A8756 /* Supporting Files */, 137 | ); 138 | path = SCXcodeSwitchExpander; 139 | sourceTree = ""; 140 | }; 141 | 18990B2918D25239007A8756 /* Supporting Files */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 18990B2A18D25239007A8756 /* SCXcodeSwitchExpander-Info.plist */, 145 | 18990B2E18D25239007A8756 /* SCXcodeSwitchExpander-Prefix.pch */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 18990B1E18D25239007A8756 /* SCXcodeSwitchExpander */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 18990B3118D25239007A8756 /* Build configuration list for PBXNativeTarget "SCXcodeSwitchExpander" */; 156 | buildPhases = ( 157 | 18990B1B18D25239007A8756 /* Sources */, 158 | 18990B1C18D25239007A8756 /* Frameworks */, 159 | 18990B1D18D25239007A8756 /* Resources */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = SCXcodeSwitchExpander; 166 | productName = SCXcodeSwitchExpander; 167 | productReference = 18990B1F18D25239007A8756 /* SCXcodeSwitchExpander.xcplugin */; 168 | productType = "com.apple.product-type.bundle"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | 18990B1718D25239007A8756 /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastUpgradeCheck = 0700; 177 | ORGANIZATIONNAME = "Stefan Ceriu"; 178 | }; 179 | buildConfigurationList = 18990B1A18D25239007A8756 /* Build configuration list for PBXProject "SCXcodeSwitchExpander" */; 180 | compatibilityVersion = "Xcode 3.2"; 181 | developmentRegion = English; 182 | hasScannedForEncodings = 0; 183 | knownRegions = ( 184 | en, 185 | ); 186 | mainGroup = 18990B1618D25239007A8756; 187 | productRefGroup = 18990B2018D25239007A8756 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | 18990B1E18D25239007A8756 /* SCXcodeSwitchExpander */, 192 | ); 193 | }; 194 | /* End PBXProject section */ 195 | 196 | /* Begin PBXResourcesBuildPhase section */ 197 | 18990B1D18D25239007A8756 /* Resources */ = { 198 | isa = PBXResourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | /* End PBXResourcesBuildPhase section */ 205 | 206 | /* Begin PBXSourcesBuildPhase section */ 207 | 18990B1B18D25239007A8756 /* Sources */ = { 208 | isa = PBXSourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | 18ECEB5718D267A0005F6C59 /* DVTTextCompletionController+SCXcodeSwitchExpander.m in Sources */, 212 | B150FD8A1CBBD7D200DFE4D8 /* DVTTextCompletionSession+SCXcodeSwitchExpander.m in Sources */, 213 | 18990B3618D2529C007A8756 /* SCXcodeSwitchExpander.m in Sources */, 214 | B18173D81CBB91E400995105 /* DVTSourceCodeLanguage+SCXCodeSwitchExpander.m in Sources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXSourcesBuildPhase section */ 219 | 220 | /* Begin XCBuildConfiguration section */ 221 | 18990B2F18D25239007A8756 /* Debug */ = { 222 | isa = XCBuildConfiguration; 223 | buildSettings = { 224 | ALWAYS_SEARCH_USER_PATHS = NO; 225 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 226 | CLANG_CXX_LIBRARY = "libc++"; 227 | CLANG_ENABLE_MODULES = YES; 228 | CLANG_ENABLE_OBJC_ARC = YES; 229 | CLANG_WARN_BOOL_CONVERSION = YES; 230 | CLANG_WARN_CONSTANT_CONVERSION = YES; 231 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 232 | CLANG_WARN_EMPTY_BODY = YES; 233 | CLANG_WARN_ENUM_CONVERSION = YES; 234 | CLANG_WARN_INT_CONVERSION = YES; 235 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | COPY_PHASE_STRIP = NO; 238 | ENABLE_TESTABILITY = YES; 239 | GCC_C_LANGUAGE_STANDARD = gnu99; 240 | GCC_DYNAMIC_NO_PIC = NO; 241 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 242 | GCC_OPTIMIZATION_LEVEL = 0; 243 | GCC_PREPROCESSOR_DEFINITIONS = ( 244 | "DEBUG=1", 245 | "$(inherited)", 246 | ); 247 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | MACOSX_DEPLOYMENT_TARGET = 10.9; 255 | ONLY_ACTIVE_ARCH = YES; 256 | SDKROOT = macosx; 257 | }; 258 | name = Debug; 259 | }; 260 | 18990B3018D25239007A8756 /* Release */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | ALWAYS_SEARCH_USER_PATHS = NO; 264 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 265 | CLANG_CXX_LIBRARY = "libc++"; 266 | CLANG_ENABLE_MODULES = YES; 267 | CLANG_ENABLE_OBJC_ARC = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 275 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 276 | COPY_PHASE_STRIP = YES; 277 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 278 | ENABLE_NS_ASSERTIONS = NO; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | MACOSX_DEPLOYMENT_TARGET = 10.9; 288 | SDKROOT = macosx; 289 | }; 290 | name = Release; 291 | }; 292 | 18990B3218D25239007A8756 /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | COMBINE_HIDPI_IMAGES = YES; 296 | DEPLOYMENT_LOCATION = YES; 297 | DSTROOT = "$(HOME)"; 298 | FRAMEWORK_SEARCH_PATHS = ( 299 | "$(inherited)", 300 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks", 301 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks", 302 | "$(PROJECT_DIR)", 303 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/OtherFrameworks", 304 | ); 305 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 306 | GCC_PREFIX_HEADER = "SCXcodeSwitchExpander/SCXcodeSwitchExpander-Prefix.pch"; 307 | INFOPLIST_FILE = "SCXcodeSwitchExpander/SCXcodeSwitchExpander-Info.plist"; 308 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 309 | PRODUCT_BUNDLE_IDENTIFIER = "com.stefanceriu.${PRODUCT_NAME:rfc1034identifier}"; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | WRAPPER_EXTENSION = xcplugin; 312 | }; 313 | name = Debug; 314 | }; 315 | 18990B3318D25239007A8756 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | COMBINE_HIDPI_IMAGES = YES; 319 | DEPLOYMENT_LOCATION = YES; 320 | DSTROOT = "$(HOME)"; 321 | FRAMEWORK_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks", 324 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks", 325 | "$(PROJECT_DIR)", 326 | "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/OtherFrameworks", 327 | ); 328 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 329 | GCC_PREFIX_HEADER = "SCXcodeSwitchExpander/SCXcodeSwitchExpander-Prefix.pch"; 330 | INFOPLIST_FILE = "SCXcodeSwitchExpander/SCXcodeSwitchExpander-Info.plist"; 331 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 332 | PRODUCT_BUNDLE_IDENTIFIER = "com.stefanceriu.${PRODUCT_NAME:rfc1034identifier}"; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | WRAPPER_EXTENSION = xcplugin; 335 | }; 336 | name = Release; 337 | }; 338 | /* End XCBuildConfiguration section */ 339 | 340 | /* Begin XCConfigurationList section */ 341 | 18990B1A18D25239007A8756 /* Build configuration list for PBXProject "SCXcodeSwitchExpander" */ = { 342 | isa = XCConfigurationList; 343 | buildConfigurations = ( 344 | 18990B2F18D25239007A8756 /* Debug */, 345 | 18990B3018D25239007A8756 /* Release */, 346 | ); 347 | defaultConfigurationIsVisible = 0; 348 | defaultConfigurationName = Release; 349 | }; 350 | 18990B3118D25239007A8756 /* Build configuration list for PBXNativeTarget "SCXcodeSwitchExpander" */ = { 351 | isa = XCConfigurationList; 352 | buildConfigurations = ( 353 | 18990B3218D25239007A8756 /* Debug */, 354 | 18990B3318D25239007A8756 /* Release */, 355 | ); 356 | defaultConfigurationIsVisible = 0; 357 | defaultConfigurationName = Release; 358 | }; 359 | /* End XCConfigurationList section */ 360 | }; 361 | rootObject = 18990B1718D25239007A8756 /* Project object */; 362 | } 363 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander.xcodeproj/xcshareddata/xcschemes/SCXcodeSwitchExpander.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 47 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTSourceCodeLanguage+SCXCodeSwitchExpander.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceCodeLanguage+SCXCodeSwitchExpander.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTSourceCodeLanguage.h" 10 | 11 | typedef NS_ENUM(NSInteger, DVTSourceCodeLanguageKind) { 12 | DVTSourceCodeLanguageKindOther, 13 | DVTSourceCodeLanguageKindObjectiveC, 14 | DVTSourceCodeLanguageKindSwift 15 | }; 16 | 17 | @interface DVTSourceCodeLanguage (SCXCodeSwitchExpander) 18 | 19 | @property (readonly) DVTSourceCodeLanguageKind switchExpander_sourceCodeLanguageKind; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTSourceCodeLanguage+SCXCodeSwitchExpander.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceCodeLanguage+SCXCodeSwitchExpander.m 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTSourceCodeLanguage+SCXCodeSwitchExpander.h" 10 | 11 | @implementation DVTSourceCodeLanguage (SCXCodeSwitchExpander) 12 | 13 | - (DVTSourceCodeLanguageKind)switchExpander_sourceCodeLanguageKind 14 | { 15 | if ([self.languageName isEqualToString:@"Objective-C"]) { 16 | return DVTSourceCodeLanguageKindObjectiveC; 17 | } 18 | else if ([self.languageName isEqualToString:@"Swift"]) { 19 | return DVTSourceCodeLanguageKindSwift; 20 | } 21 | 22 | return DVTSourceCodeLanguageKindOther; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionController+SCXcodeSwitchExpander.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTTextCompletionController.h" 10 | #import "DVTTextCompletionListWindowController.h" 11 | 12 | @interface DVTTextCompletionController (SCXcodeSwitchExpander) 13 | 14 | @end -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionController+SCXcodeSwitchExpander.m 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTTextCompletionController+SCXcodeSwitchExpander.h" 10 | 11 | #import "SCXcodeSwitchExpander.h" 12 | 13 | #import "DVTSourceCodeLanguage+SCXcodeSwitchExpander.h" 14 | #import "DVTSourceTextView.h" 15 | #import "DVTTextStorage.h" 16 | 17 | #import "IDEIndex.h" 18 | #import "IDEIndexCollection.h" 19 | #import "IDEIndexCompletionItem.h" 20 | #import "IDEIndexContainerSymbol.h" 21 | #import "IDEWorkspace.h" 22 | #import "DVTSourceCodeSymbolKind.h" 23 | #import "DVTSourceTextView.h" 24 | 25 | #import "DVTTextCompletionSession+SCXcodeSwitchExpander.h" 26 | 27 | #import 28 | 29 | @interface DVTTextCompletionListWindowController (SCXcodeSwitchExpander) 30 | 31 | - (BOOL)tryExpandingSwitchStatementForLanguage:(DVTSourceCodeLanguageKind)language; 32 | 33 | @end 34 | 35 | @implementation DVTTextCompletionController (SCXcodeSwitchExpander) 36 | 37 | + (void)load 38 | { 39 | Method originalMethod = class_getInstanceMethod(self, @selector(acceptCurrentCompletion)); 40 | Method swizzledMethod = class_getInstanceMethod(self, @selector(scSwizzledAcceptCurrentCompletion)); 41 | 42 | if ((originalMethod != nil) && (swizzledMethod != nil)) { 43 | method_exchangeImplementations(originalMethod, swizzledMethod); 44 | } 45 | } 46 | 47 | - (BOOL)scSwizzledAcceptCurrentCompletion 48 | { 49 | if([self.currentSession.listWindowController tryExpandingSwitchStatementForLanguage:self.currentLanguage]) { 50 | return YES; 51 | } 52 | 53 | return [self scSwizzledAcceptCurrentCompletion]; 54 | } 55 | 56 | - (DVTSourceCodeLanguageKind)currentLanguage 57 | { 58 | DVTSourceTextView *textView = (DVTSourceTextView *)self.textView; 59 | DVTTextStorage *textStorage = (DVTTextStorage *)textView.textStorage; 60 | DVTSourceCodeLanguage *language = textStorage.language; 61 | 62 | return language.switchExpander_sourceCodeLanguageKind; 63 | } 64 | 65 | @end 66 | 67 | @implementation DVTTextCompletionListWindowController (SCXcodeSwitchExpander) 68 | 69 | - (BOOL)tryExpandingSwitchStatementForLanguage:(DVTSourceCodeLanguageKind)language 70 | { 71 | IDEWorkspace *workspace = self.session.switchExpander_currentWorkspace; 72 | IDEIndex *index = workspace.index; 73 | 74 | if(index == nil) { 75 | return NO; 76 | } 77 | 78 | IDEIndexCompletionItem *item = [self _selectedCompletionItem]; 79 | 80 | // Fetch all symbols matching the autocomplete item type 81 | NSString *symbolName = (item.displayType.length ? item.displayType : item.displayText); 82 | 83 | // Remove C++ namespaces 84 | symbolName = [[symbolName componentsSeparatedByString:@"::"] lastObject]; 85 | 86 | // Remove enum keyword 87 | symbolName = [symbolName stringByReplacingOccurrencesOfString:@"^enum\\s+" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, symbolName.length)]; 88 | 89 | // Remove Swift tuple (e.g. `(SomeClass.Result)` to `SomeClass.Result`). This occurs at the closure passed only single enum argument. 90 | symbolName = [symbolName stringByReplacingOccurrencesOfString:@"^\\((.*)\\)$" withString:@"$1" options:NSRegularExpressionSearch range: NSMakeRange(0, symbolName.length)]; 91 | 92 | NSArray *symbols = [self _getSymbolsByFullName:symbolName forLanguage:language fromIndex:index]; 93 | 94 | // Find the first one of them that is a container 95 | for(IDEIndexSymbol *symbol in symbols) { 96 | 97 | DVTSourceCodeSymbolKind *symbolKind = symbol.symbolKind; 98 | 99 | BOOL isSymbolKindEnum = NO; 100 | for(DVTSourceCodeSymbolKind *conformingSymbol in symbolKind.allConformingSymbolKinds) { 101 | isSymbolKindEnum = [self _isSymbolKindEnum:conformingSymbol]; 102 | } 103 | 104 | if (!isSymbolKindEnum) { 105 | return NO; 106 | } 107 | 108 | if(symbolKind.isContainer) { 109 | 110 | DVTSourceTextView *textView = (DVTSourceTextView *)self.session.textView; 111 | if(self.session.wordStartLocation == NSNotFound) { 112 | return NO; 113 | } 114 | 115 | // Fetch the previous new line 116 | NSRange newLineRange = [textView.string rangeOfString:@"\n" options:NSBackwardsSearch range:NSMakeRange(0, self.session.wordStartLocation)]; 117 | if(newLineRange.location == NSNotFound) { 118 | return NO; 119 | } 120 | 121 | // See if the current line has a switch statement 122 | NSString *regPattern; 123 | switch (language) { 124 | case DVTSourceCodeLanguageKindObjectiveC: 125 | case DVTSourceCodeLanguageKindOther: { 126 | regPattern = @"\\s+switch\\s*\\\("; 127 | break; 128 | } 129 | case DVTSourceCodeLanguageKindSwift: { 130 | regPattern = @"\\s+switch\\s*"; 131 | break; 132 | } 133 | } 134 | 135 | NSRange switchRange = [textView.string rangeOfString:regPattern options:NSRegularExpressionSearch range:NSMakeRange(newLineRange.location, self.session.wordStartLocation - newLineRange.location)]; 136 | if(switchRange.location == NSNotFound) { 137 | return NO; 138 | } 139 | 140 | // Insert the selected autocomplete item 141 | [self.session insertCurrentCompletion]; 142 | 143 | // Fetch the opening bracket for that switch statement 144 | NSUInteger openingBracketLocation = [textView.string rangeOfString:@"{" options:0 range:NSMakeRange(self.session.wordStartLocation, textView.string.length - self.session.wordStartLocation)].location; 145 | if(openingBracketLocation == NSNotFound) { 146 | return NO; 147 | } 148 | 149 | // Check if it's the opening bracket for the switch statement or something else 150 | NSString *remainingText = [textView.string substringWithRange:NSMakeRange(switchRange.location + switchRange.length, openingBracketLocation - switchRange.location - switchRange.length)]; 151 | if([remainingText rangeOfString:@"}"].location != NSNotFound) { 152 | return NO; 153 | } 154 | 155 | NSRange selectedRange = textView.selectedRange; 156 | 157 | // Fetch the closing bracket for that switch statement 158 | NSUInteger closingBracketLocation = [self matchingBracketLocationForOpeningBracketLocation:openingBracketLocation inString:textView.string]; 159 | if(closingBracketLocation == NSNotFound) { 160 | return NO; 161 | } 162 | 163 | NSRange defaultAutocompletionRange; 164 | // Get rid of the default autocompletion if necessary 165 | switch (language) { 166 | case DVTSourceCodeLanguageKindSwift: { 167 | defaultAutocompletionRange = [textView.string rangeOfString:@"\\s*case .<#constant#>:\\s*<#statements#>\\s*break\\s*default:\\s*break\\s*" options:NSRegularExpressionSearch range:NSMakeRange(openingBracketLocation, closingBracketLocation - openingBracketLocation)]; 168 | break; 169 | } 170 | case DVTSourceCodeLanguageKindObjectiveC: 171 | case DVTSourceCodeLanguageKindOther: { 172 | defaultAutocompletionRange = [textView.string rangeOfString:@"\\s*case <#constant#>:\\s*<#statements#>\\s*break;\\s*default:\\s*break;\\s*" options:NSRegularExpressionSearch range:NSMakeRange(openingBracketLocation, closingBracketLocation - openingBracketLocation)]; 173 | break; 174 | } 175 | } 176 | 177 | if(defaultAutocompletionRange.location != NSNotFound) { 178 | [textView insertText:@"" replacementRange:defaultAutocompletionRange]; 179 | closingBracketLocation -= defaultAutocompletionRange.length; 180 | } 181 | 182 | NSRange switchContentRange = NSMakeRange(openingBracketLocation + 1, closingBracketLocation - openingBracketLocation - 1); 183 | NSString *switchContent = [textView.string substringWithRange:switchContentRange]; 184 | 185 | // Generate the items to insert and insert them at the end 186 | NSMutableString *replacementString = [NSMutableString string]; 187 | 188 | NSString *trimmedContent = [switchContent stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 189 | 190 | if(trimmedContent.length == 0) { 191 | // Remove extraneous empty lines if existing content is only whitespace 192 | if (switchContent.length > 0) { 193 | [textView insertText:@"" replacementRange:switchContentRange]; 194 | closingBracketLocation -= switchContent.length; 195 | switchContentRange.length = 0; 196 | [replacementString appendString:@"\n"]; 197 | } else { 198 | // Keep Swift code compact 199 | if (language != DVTSourceCodeLanguageKindSwift) { 200 | [replacementString appendString:@"\n"]; 201 | } 202 | } 203 | } 204 | 205 | for(IDEIndexSymbol *child in [((IDEIndexContainerSymbol*)symbol).children allObjects]) { 206 | 207 | // Skip the `child` symbol if it is not a enum constant. 208 | if (![self _isSymbolKindEnumConstant:child.symbolKind]) 209 | { 210 | continue; 211 | } 212 | 213 | if([switchContent rangeOfString:child.displayName].location == NSNotFound) { 214 | switch (language) { 215 | case DVTSourceCodeLanguageKindSwift: { 216 | NSString *childDisplayName = [self _correctEnumConstantIfFromCocoa:[NSString stringWithFormat:@"%@",symbol] symbolName:symbolName cocoaEnumName:child.displayName]; 217 | [replacementString appendString:[NSString stringWithFormat:@"case .%@: \n<#statement#>\n", childDisplayName]]; 218 | break; 219 | } 220 | case DVTSourceCodeLanguageKindObjectiveC: 221 | case DVTSourceCodeLanguageKindOther: { 222 | [replacementString appendString:[NSString stringWithFormat:@"case %@: {\n<#statement#>\nbreak;\n}\n", child.displayName]]; 223 | break; 224 | } 225 | } 226 | } 227 | } 228 | 229 | [textView insertText:replacementString replacementRange:NSMakeRange(switchContentRange.location + switchContentRange.length, 0)]; 230 | 231 | closingBracketLocation += replacementString.length; 232 | switchContentRange = NSMakeRange(openingBracketLocation + 1, closingBracketLocation - openingBracketLocation - 1); 233 | switchContent = [textView.string substringWithRange:switchContentRange]; 234 | 235 | // // Insert the default case if necessary 236 | // if([switchContent rangeOfString:@"default"].location == NSNotFound) { 237 | // if ([[SCXcodeSwitchExpander sharedSwitchExpander] isSwift]) { 238 | // replacementString = [NSMutableString stringWithString:@"default: \nbreak\n\n"]; 239 | // } else { 240 | // replacementString = [NSMutableString stringWithString:@"default: {\nbreak;\n}\n"]; 241 | // } 242 | // [textView insertText:replacementString replacementRange:NSMakeRange(switchContentRange.location + switchContentRange.length, 0)]; 243 | // closingBracketLocation += replacementString.length; 244 | // } 245 | 246 | // Re-indent everything 247 | NSRange reindentRange = NSMakeRange(openingBracketLocation, closingBracketLocation - openingBracketLocation + 2); 248 | [textView _indentInsertedTextIfNecessaryAtRange:reindentRange]; 249 | 250 | // Preserve the selected range 251 | [textView setSelectedRange:selectedRange]; 252 | 253 | return YES; 254 | } 255 | 256 | break; 257 | } 258 | 259 | return NO; 260 | } 261 | 262 | #pragma mark - Private helpers 263 | 264 | - (NSString *)_correctEnumConstantIfFromCocoa:(NSString *)symbol symbolName:(NSString *)symbolName cocoaEnumName:(NSString *)enumName 265 | { 266 | if ([symbol rangeOfString:@"c:@E@"].location != NSNotFound) { 267 | return [enumName stringByReplacingOccurrencesOfString:symbolName withString:@""]; 268 | } 269 | 270 | return enumName; 271 | } 272 | 273 | /// Returns a boolean value whether `symbolKind` means a enum type. 274 | - (BOOL)_isSymbolKindEnum:(DVTSourceCodeSymbolKind *)symbol 275 | { 276 | return [symbol.identifier isEqualToString:@"Xcode.SourceCodeSymbolKind.Enum"]; 277 | } 278 | 279 | /// Returns a boolean value whether `symbolKind` means a enum constant. 280 | - (BOOL)_isSymbolKindEnumConstant:(DVTSourceCodeSymbolKind *)symbolKind 281 | { 282 | return [symbolKind.identifier isEqualToString:@"Xcode.SourceCodeSymbolKind.EnumConstant"]; 283 | } 284 | 285 | - (NSUInteger)matchingBracketLocationForOpeningBracketLocation:(NSUInteger)location inString:(NSString *)string 286 | { 287 | if(string.length == 0) { 288 | return NSNotFound; 289 | } 290 | 291 | NSInteger matchingLocation = location; 292 | NSInteger counter = 1; 293 | while (counter > 0) { 294 | matchingLocation ++; 295 | 296 | if(matchingLocation == string.length - 1) { 297 | return NSNotFound; 298 | } 299 | 300 | NSString *character = [string substringWithRange:NSMakeRange(matchingLocation, 1)]; 301 | 302 | if ([character isEqualToString:@"{"]) { 303 | counter++; 304 | } 305 | else if ([character isEqualToString:@"}"]) { 306 | counter--; 307 | } 308 | } 309 | 310 | return matchingLocation; 311 | } 312 | 313 | - (NSArray*)_getSymbolsByFullName:(NSString*)fullSymbolName forLanguage:(DVTSourceCodeLanguageKind)language fromIndex:(IDEIndex*)index 314 | { 315 | NSArray *names = [self _symbolNamesFromFullSymbolName:fullSymbolName forLanguage:language]; 316 | NSString *lastName = names.lastObject; 317 | 318 | NSArray *symbols = [[index allSymbolsMatchingName:lastName kind:nil] allObjects]; 319 | NSIndexSet *enumSymbolIndexes = [symbols indexesOfObjectsPassingTest:^BOOL(IDEIndexSymbol *symbol, NSUInteger idx, BOOL *stop) { 320 | return [self _isSymbolKindEnum:symbol.symbolKind]; 321 | }]; 322 | NSArray *enumSymbols = [symbols objectsAtIndexes:enumSymbolIndexes]; 323 | 324 | for (NSInteger nameIndex = names.count - 2; nameIndex != -1; --nameIndex) { 325 | if (enumSymbols.count <= 1) { 326 | break; 327 | } 328 | 329 | NSString *currentName = [names objectAtIndex:nameIndex]; 330 | NSArray *currentSymbols = [[index allSymbolsMatchingName:currentName kind:nil] allObjects]; 331 | 332 | NSIndexSet *validEnumSymbolIndexes = [enumSymbols indexesOfObjectsPassingTest:^BOOL(IDEIndexSymbol *enumSymbol, NSUInteger idx, BOOL *stop) { 333 | NSString *enumSymbolNamespace = [self _namespaceForResolutionOfSymbol:enumSymbol]; 334 | for (IDEIndexSymbol *currentSymbol in currentSymbols) { 335 | NSString *currentSymbolNamespace = [self _namespaceForResolutionOfSymbol:currentSymbol]; 336 | if ([enumSymbolNamespace hasPrefix:currentSymbolNamespace]) { 337 | return YES; 338 | } 339 | } 340 | return NO; 341 | }]; 342 | 343 | enumSymbols = [enumSymbols objectsAtIndexes:validEnumSymbolIndexes]; 344 | } 345 | 346 | return enumSymbols; 347 | } 348 | 349 | /// Returns namespace name by symbol's resolution. 350 | - (NSString *)_namespaceForResolutionOfSymbol:(IDEIndexSymbol *)symbol 351 | { 352 | NSString *resolution = symbol.resolution; 353 | return [resolution stringByReplacingOccurrencesOfString:@"^s:\\w+16" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, resolution.length)]; 354 | } 355 | 356 | /// Returns symbol names from swift style full symbol name (e.g. from `Mirror.DisplayStyle` to `[Mirror, DisplayStyle]`). 357 | - (NSArray*)_symbolNamesFromFullSymbolName:(NSString *)fullSymbolName forLanguage:(DVTSourceCodeLanguageKind)language 358 | { 359 | NSMutableArray *names = [[fullSymbolName componentsSeparatedByString:@"."] mutableCopy]; 360 | for (NSInteger nameIndex = 0; nameIndex != names.count; ++nameIndex) { 361 | names[nameIndex] = [self _normalizedSymbolName:names[nameIndex] forLanguage:language]; 362 | } 363 | 364 | return [names copy]; 365 | } 366 | 367 | /// Returns normalized symbol name for -[IDEIndex allSymbolsMatchingName:kind:]. 368 | - (NSString *)_normalizedSymbolName:(NSString *)symbolName forLanguage:(DVTSourceCodeLanguageKind)language 369 | { 370 | NSString *result = symbolName; 371 | result = [self _symbolNameByRemovingGenericParameter:result forLanguage:language]; 372 | result = [self _symbolNameByReplacingOptionalName:result forLanguage:language]; 373 | 374 | return result; 375 | } 376 | 377 | /// Returns a symbol name removed swift generic parameter (e.g. `SomeType` to `SomeType`). 378 | - (NSString *)_symbolNameByRemovingGenericParameter:(NSString *)symbolName forLanguage:(DVTSourceCodeLanguageKind)language 379 | { 380 | switch (language) { 381 | case DVTSourceCodeLanguageKindSwift: { 382 | return [symbolName stringByReplacingOccurrencesOfString:@"<[^>]+>$" 383 | withString:@"" 384 | options:NSRegularExpressionSearch 385 | range:NSMakeRange(0, symbolName.length)]; 386 | } 387 | case DVTSourceCodeLanguageKindObjectiveC: 388 | case DVTSourceCodeLanguageKindOther: { 389 | return symbolName; 390 | } 391 | } 392 | } 393 | 394 | /// Returns a symbol name replaced syntax suggered optional to formal type name type in Swift (e.g. `Int?` to `Optional). 395 | - (NSString *)_symbolNameByReplacingOptionalName:(NSString *)symbolName forLanguage:(DVTSourceCodeLanguageKind)language 396 | { 397 | switch (language) { 398 | case DVTSourceCodeLanguageKindSwift: { 399 | if ([symbolName hasSuffix:@"?"]) { 400 | return @"Optional"; 401 | } 402 | else if ([symbolName hasSuffix:@"!"]) { 403 | return @"ImplicitlyUnwrappedOptional"; 404 | } 405 | else { 406 | return symbolName; 407 | } 408 | } 409 | case DVTSourceCodeLanguageKindObjectiveC: 410 | case DVTSourceCodeLanguageKindOther: { 411 | return symbolName; 412 | } 413 | } 414 | } 415 | 416 | @end 417 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTTextCompletionSession+SCXcodeSwitchExpander.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionSession+SCXcodeSwitchExpander.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTTextCompletionSession.h" 10 | 11 | @class IDEWorkspace; 12 | 13 | @interface DVTTextCompletionSession (SCXcodeSwitchExpander) 14 | 15 | @property (readonly) IDEWorkspace *switchExpander_currentWorkspace; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/DVTTextCompletionSession+SCXcodeSwitchExpander.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionSession+SCXcodeSwitchExpander.m 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTTextCompletionSession+SCXcodeSwitchExpander.h" 10 | #import "IDEWorkspace.h" 11 | 12 | @implementation DVTTextCompletionSession (SCXcodeSwitchExpander) 13 | 14 | - (IDEWorkspace *)switchExpander_currentWorkspace 15 | { 16 | return [self.currentCompletionContext valueForKey:@"IDETextCompletionContextWorkspaceKey"]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/SCXcodeSwitchExpander-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 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 | BNDL 19 | CFBundleShortVersionString 20 | 1.0.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | FEC992CC-CA4A-4CFD-8881-77300FCB848A 28 | C4A681B0-4A26-480E-93EC-1218098B9AA0 29 | A2E4D43F-41F4-4FB9-BB94-7177011C9AED 30 | AD68E85B-441B-4301-B564-A45E4919A6AD 31 | 63FC1C47-140D-42B0-BB4D-A10B2D225574 32 | 37B30044-3B14-46BA-ABAA-F01000C27B63 33 | 640F884E-CE55-4B40-87C0-8869546CAB7A 34 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 35 | A16FF353-8441-459E-A50C-B071F53F51B7 36 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 37 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 38 | E969541F-E6F9-4D25-8158-72DC3545A6C6 39 | 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 40 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 41 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 42 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 43 | CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 44 | 7265231C-39B4-402C-89E1-16167C4CC990 45 | F41BD31E-2683-44B8-AE7F-5F09E919790E 46 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 47 | 48 | NSHumanReadableCopyright 49 | Copyright © 2014 Stefan Ceriu. All rights reserved. 50 | NSPrincipalClass 51 | 52 | XC4Compatible 53 | 54 | XCGCReady 55 | 56 | XCPluginHasUI 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/SCXcodeSwitchExpander-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/SCXcodeSwitchExpander.h: -------------------------------------------------------------------------------- 1 | // 2 | // SCXcodeSwitchExpander.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @interface SCXcodeSwitchExpander : NSObject 10 | 11 | + (instancetype)sharedSwitchExpander; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/SCXcodeSwitchExpander.m: -------------------------------------------------------------------------------- 1 | // 2 | // SCXcodeSwitchExpander.m 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "SCXcodeSwitchExpander.h" 10 | 11 | static SCXcodeSwitchExpander *sharedExpander = nil; 12 | 13 | @implementation SCXcodeSwitchExpander 14 | 15 | + (void)pluginDidLoad:(NSBundle *)plugin 16 | { 17 | BOOL isApplicationXcode = [[[NSBundle mainBundle] infoDictionary][@"CFBundleName"] isEqual:@"Xcode"]; 18 | if (isApplicationXcode) { 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | sharedExpander = [[self alloc] init]; 22 | }); 23 | } 24 | } 25 | 26 | + (instancetype)sharedSwitchExpander 27 | { 28 | return sharedExpander; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTCompletingTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTCompletingTextView.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @interface DVTCompletingTextView : NSTextView 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTSourceCodeLanguage.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceCodeLanguage.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DVTSourceCodeLanguage : NSObject 12 | 13 | @property(readonly, copy) NSString *languageName; 14 | 15 | - (BOOL)conformsToLanguage:(id)arg1; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTSourceCodeSymbolKind.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceCodeSymbolKind.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class NSArray, NSString; 10 | 11 | @interface DVTSourceCodeSymbolKind : NSObject 12 | 13 | @property(readonly) NSString *identifier; 14 | @property(readonly, getter=isContainer) BOOL container; 15 | @property(readonly) NSArray *allConformingSymbolKinds; 16 | 17 | @end -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTSourceTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTSourceTextView.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTCompletingTextView.h" 10 | 11 | @interface DVTSourceTextView : DVTCompletingTextView 12 | 13 | - (struct _NSRange)_indentInsertedTextIfNecessaryAtRange:(struct _NSRange)arg1; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTTextCompletionController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionController.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class DVTCompletingTextView; 10 | @class DVTTextCompletionSession; 11 | 12 | @interface DVTTextCompletionController : NSObject 13 | 14 | @property(readonly) DVTCompletingTextView *textView; 15 | @property(retain) DVTTextCompletionSession *currentSession; 16 | 17 | - (BOOL)acceptCurrentCompletion; 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTTextCompletionListWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionListWindowController.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @interface DVTTextCompletionListWindowController : NSWindowController 10 | 11 | @property(readonly) DVTTextCompletionSession *session; 12 | 13 | - (id)_selectedCompletionItem; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTTextCompletionSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextCompletionSession.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class DVTTextCompletionListWindowController; 10 | @class DVTCompletingTextView; 11 | 12 | @interface DVTTextCompletionSession : NSObject 13 | 14 | @property(readonly, nonatomic) NSDictionary *currentCompletionContext; 15 | @property(readonly) unsigned long long wordStartLocation; 16 | @property(readonly) DVTTextCompletionListWindowController *listWindowController; 17 | @property(readonly) DVTCompletingTextView *textView; 18 | 19 | - (BOOL)insertCurrentCompletion; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTTextStorage.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTTextStorage.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DVTSourceCodeLanguage; 12 | 13 | @interface DVTTextStorage : NSTextStorage 14 | 15 | @property(copy) DVTSourceCodeLanguage *language; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/DVTViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVTViewController.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 16/05/2015. 6 | // Copyright (c) 2015 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DVTViewController : NSViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEEditor.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEEditor.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 16/05/2015. 6 | // Copyright (c) 2015 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "DVTViewController.h" 10 | 11 | @class IDEFileTextSettings; 12 | 13 | @interface IDEEditor : DVTViewController 14 | 15 | @property(retain, nonatomic) IDEFileTextSettings *fileTextSettings; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEFileTextSettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEFileTextSettings.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 16/05/2015. 6 | // Copyright (c) 2015 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class IDEFileReference; 10 | 11 | @interface IDEFileTextSettings : NSObject 12 | 13 | @property(retain, nonatomic) IDEFileReference *fileReference; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndex.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndex.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @interface IDEIndex : NSObject 10 | 11 | - (id)allSymbolsMatchingName:(id)arg1 kind:(id)arg2; 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndexClassSymbol.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndexClassSymbol.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/11/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "IDEIndexContainerSymbol.h" 10 | 11 | @interface IDEIndexClassSymbol : IDEIndexContainerSymbol 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndexCollection.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndexCollection.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 13/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @interface IDEIndexCollection : NSObject 10 | 11 | - (id)allObjects; 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndexCompletionItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndexCompletionItem.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 17/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class DVTSourceCodeSymbolKind; 10 | 11 | @interface IDEIndexCompletionItem : NSObject 12 | 13 | @property(readonly) NSString *name; 14 | @property(readonly) DVTSourceCodeSymbolKind *symbolKind; 15 | @property(readonly) NSString *displayType; 16 | @property(readonly) NSString *displayText; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndexContainerSymbol.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndexContainerSymbol.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 17/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | #import "IDEIndexSymbol.h" 10 | 11 | @interface IDEIndexContainerSymbol : IDEIndexSymbol 12 | 13 | - (id)children; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEIndexSymbol.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEIndexSymbol.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Stefan Ceriu on 17/03/2014. 6 | // Copyright (c) 2014 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class DVTSourceCodeSymbolKind; 10 | 11 | @interface IDEIndexSymbol : NSObject 12 | 13 | @property(readonly, nonatomic) NSString *resolution; 14 | @property(readonly, nonatomic) NSString *name; 15 | @property(readonly, nonatomic) DVTSourceCodeSymbolKind *symbolKind; 16 | 17 | - (id)displayName; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SCXcodeSwitchExpander/Xcode Headers/IDEWorkspace.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEWorkspace.h 3 | // SCXcodeSwitchExpander 4 | // 5 | // Created by Tomohiro Kumagai on 4/9/16. 6 | // Copyright © 2016 Stefan Ceriu. All rights reserved. 7 | // 8 | 9 | @class IDEIndex; 10 | 11 | @interface IDEWorkspace : NSObject 12 | 13 | @property (retain) IDEIndex *index; 14 | 15 | - (void)_updateIndexableFiles:(id)arg1; 16 | 17 | @end 18 | --------------------------------------------------------------------------------