fortinmike / XcodeBoost

An Xcode plugin that aims to make altering and inspecting code quick and easy.
MIT License
817 stars 86 forks source link

Select Methods and Functions does not work under certain conditions #29

Closed MP0w closed 10 years ago

MP0w commented 10 years ago

If I use something like this:

        UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);

inside a method the highlight of methods doesn't work properly.

fortinmike commented 10 years ago

Hi @MP0w. You're talking about the "Select Methods and Functions" feature, right?

If so, it works OK on my end when I add the function call you provided in some methods then try to select them using "Select Methods and Functions".

You should make sure you have the latest XcodeBoost installed. One way to do it would be to uninstall then reinstall the plugin using Alcatraz. I think Alcatraz is supposed to auto-update plugins, but I'm not sure about that.

Please reply with your findings.

MP0w commented 10 years ago

it turned out that is my code style that cause problem, an if/for/... with a bracket without new line:

if(1){
}

Cause problems... However, checking with a program like http://reggyapp.com and your regex works fine, so I do not know how to help.

MP0w commented 10 years ago

If you want to try...

#ifdef GBSANDBOX

//  NSMutableArray+JSON.m
//  GoodBarber
//  Created by MPow on 18/07/13.
//  Copyright (c) 2013 MPow. All rights reserved.
//

#import "NSArray+JSON.h"

@implementation NSArray(JSON)

-(NSString *)encodeJSON{

    for (int i=0; i<[self count]; i++) {
    }

}
@end
#endif
fortinmike commented 10 years ago

Thanks, I was just about to ask you for a copy-paste of the problematic method. I'll check this out soon.

fortinmike commented 10 years ago

So, I finally took the time to figure this out. It seems it was a too-liberal function-finding regex that caused the issue. This is fixed in a10f42b.

The issue would appear whenever we asked the plugin to select the method directly below the @implementation block, so it wasn't as much of an edge case as it seemed!

Thanks again for reporting this! :+1: