Skip to content

Add various Objective-C enhancements - #1698

Merged
BradLewis merged 2 commits into
DanielGavin:masterfrom
harold-b:hb.objc-feature-improvements
Sep 22, 2026
Merged

BradLewis merged 2 commits into
DanielGavin:masterfrom
harold-b:hb.objc-feature-improvements

Conversation

@harold-b

Copy link
Copy Markdown
Contributor
  • Objective-C methods returning instancetype now 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_name attribute 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_Block capture completion using the handler’s parameter types.

  • Added hover formatting for Objc_Block that separates callback parameters from captures, showing captures in brackets (actual_param, [captured_param1, captured_param2]).

  • Added an Objc_Block code action that generates a handler proc using 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)

- 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
harold-b marked this pull request as draft September 21, 2026 21:29
@harold-b

Copy link
Copy Markdown
Contributor Author

Fixing CI-surfaced issues...

@harold-b
harold-b marked this pull request as ready for review September 21, 2026 21:45
@harold-b

Copy link
Copy Markdown
Contributor Author

✅

@BradLewis BradLewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@BradLewis
BradLewis merged commit 6e7d1e9 into DanielGavin:master Sep 22, 2026
3 checks passed
@harold-b
harold-b deleted the hb.objc-feature-improvements branch September 22, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants