When completing an Objective-C method declaration by name, we need to
preserve the leading text as a qualifier so we insert it properly
before the first typed text chunk.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The test results look good, but I have trouble following the code, I think more comments might help :-)
clang-tools-extra/clangd/CodeCompletionStrings.cpp | ||
---|---|---|
140 | can we say something more concrete than "the prefix of our snippet"? this is the -(void) part right? | |
151 | is this TODO handled now? | |
155 | brief comment here should explain the significance of !HadInformativeArguments (what it means if we know we're handling objc) Maybe even worth an example here, not obvious to me what the data is that we're shuffling between variables here. | |
203 | informative chunks? Not sure how we'd know they're arguments here. |
Address review comments
clang-tools-extra/clangd/CodeCompletionStrings.cpp | ||
---|---|---|
151 | No, this does not change any behavior for parameters (we don't show the full ObjcMethodDecl signature including previous parameter types if you complete it from the middle) |
Thanks for the detailed comments, this makes a lot more sense to me now!
clang-tools-extra/clangd/CodeCompletionStrings.cpp | ||
---|---|---|
160 | Does completing the no-args declaration - (void) foo work as expected? We never get to this part of the code in this case because endswith(":") is never true. The comment above says "safe to treat as c++" but not sure this is true for declaration, just method calls. Maybe it works for some other reason though? In any case, it's OK if this case doesn't work (this patch still improves things a lot). We should probably have a test showing what the state is. |
clang-tools-extra/clangd/CodeCompletionStrings.cpp | ||
---|---|---|
160 | Yeah, it does. I added a test case for it, it does work, the current behavior is fine, the issue for ObjC is specifically selectors with arguments. |
can we say something more concrete than "the prefix of our snippet"? this is the -(void) part right?