Add various Objective-C enhancements - #1698
Merged
BradLewis merged 2 commits intoSep 22, 2026
Merged
Conversation
- Resolve Objective-C instancetype to the concrete receiver type. - Preserve inherited method and ivar definition locations. - Fix Objective-C completion through nested fields. - Add inherited ivar completion with nearest-class shadowing and ivars listed first. - Infer Objective-C method names when @objc_name is omitted. - Add type-aware Objc_Block capture completion and capture-aware hover. - Add a code action to generate Objc_Block handlers. - Speed up Objective-C completion while retaining fake methods.
harold-b
marked this pull request as draft
September 21, 2026 21:29
Contributor
Author
|
Fixing CI-surfaced issues... |
harold-b
marked this pull request as ready for review
September 21, 2026 21:45
Contributor
Author
|
✅ |
BradLewis
approved these changes
Sep 22, 2026
BradLewis
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! I don't have a good objc setup to really test this out, but overall it's working for me and it looks good so LGTM!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective-C methods returning
instancetypenow resolve to the receiver’s concrete class. This works through local variables, inherited methods, chained calls, and parentheses, so completion, hover, and navigation agree on the type.Definition links point to the objc class' method or ivar actual source file, including inherited members. Completion also works through selector chains such as
self.impl->.ObjC ivars appear before methods in completion. Parent ivars are included, the nearest class wins when there are name collisions.
ObjC methods without the
@objc_nameattribute are implicitly indexed via the same rule Odin uses. It removes the matching class name's prefix from their Odin procedure name. Explicit names still take precedence.Added support for
Objc_Blockcapture completion using the handler’s parameter types.Added hover formatting for
Objc_Blockthat separates callback parameters from captures, showing captures in brackets (actual_param, [captured_param1, captured_param2]).Added an
Objc_Blockcode action that generates a handlerprocusing the expected callback signature and captured values. It handles unfinished calls and missing commas, keeps known names and types, and leaves unknown types blank.Member completion in an Objective-C-heavy file improved from 1,242.75 ms to 23.50 ms median, nearly 53× faster. The optimization avoids resolving the same receiver type for each fake method. (This is not an objc-specific improvement, but any fake method indexing, though this particular file had a very large improvement, along with an objc-specific improvement when doing ivars)