This patch depends on https://reviews.llvm.org/D25519.
This patch changes the way that Objective-C block properties are code complete: clang now suggests completion with an additional '=' and the block literal placeholder when providing member access completions for appropriate readwrite block properties. This patch uses a simple heuristic to determine if it's appropriate to suggest a setter completion for block properties: if we are completing member access that is a standalone statement, we provide setter completion. Otherwise we fallback to the default property completion.
The following example illustrates when the setter completion is triggered:
@interface Test : Obj
@property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
@end
@implementation Test
- foo {
self.<COMPLETION> // will complete with ‘=‘ and block
}
- fooNot {
// These will code complete normally:
(self.<COMPLETION>)
return self.<COMPLETION>
[self foo: self.<COMPLETION>]
if (self.<COMPLETION>) { }
}
@end