Trying to mimic the alloc live template for new instead
Hi,
I am trying to mimic the live template for alloc where one would type alloc and hit tab and AppCode inserts [[MyObject alloc] init]. I want to make one for new so AppCode completes it to [MyObject new];
My problem is that it only recognizes the correct classnamewhen I have two open square brackets in the beginning of the live templeate like this [[$TYPE$ new];$END$ but this leaves me with noncompiling code since one bracket is to much. So remove the first bracket I thought and now it does not recognize the correct class name any more and inserts just plain NSObject everytime.
Variable $Type" is declared like this: expression: className() default value: "NSObject"
Any hints how I can make my live template work?
请先登录再写评论。
This seems to be a bug in the live template that it doesn't suggest the correct type: http://youtrack.jetbrains.com/issue/OC-5405

But, actually, you don't need a live template for it - use smart completion in the assignments:
NSString *s = <press Shift+Ctrl+Space and after that type new>:
See our blog for more tricks with completion: http://blog.jetbrains.com/objc/category/tipsntricks/
Ok thanks . Always forgetting about smart completion since AppCode does such a good job without smart completion too ;)