diff --git a/README.md b/README.md index 518330c..e3bce1c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ SCXcodeSwitchExpander is a small Xcode plugin that expands switch statements by - 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. -- only works with NS_ENUM but keeps default Xcode behavior for old style enums +- does not work with anonymous enums ### Installation diff --git a/SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m b/SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m index f9fd37b..8b1154f 100644 --- a/SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m +++ b/SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m @@ -65,6 +65,9 @@ - (BOOL)tryExpandingSwitchStatement // Fetch all symbols matching the autocomplete item type NSString *symbolName = (item.displayType.length ? item.displayType : item.displayText); + symbolName = [[symbolName componentsSeparatedByString:@"::"] lastObject]; // Remove C++ namespaces + symbolName = [[symbolName componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] lastObject]; // Remove enum keyword + IDEIndexCollection *collection = [index allSymbolsMatchingName:symbolName kind:nil]; // Find the first one of them that is a container