Run swift-format over the CandidateUI package - #752
Conversation
No other packages still specify `platforms`, and also make one `init` method `@objc` so that the code can be shared with OpenVanilla.
Summary of ChangesHello @lukhnos, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the CandidateUI package by standardizing its code style, improving interoperability with Objective-C, and streamlining its package manifest. These changes contribute to a more consistent and flexible codebase. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request primarily applies swift-format across the CandidateUI package, leading to widespread stylistic improvements. It also removes the minimum platform version specification for consistency and adds @objc to an initializer to facilitate interoperability with Objective-C code, as noted in the description. While the formatting changes are beneficial, I've identified a critical issue in the test suite where VerticalCandidateControllerTests.swift contains tests that incorrectly instantiate HorizontalCandidateController. This oversight means key functionality of the vertical controller is not being tested. Please see my comments for details on fixing this.
| @Test( | ||
| "Test if candidate controller can be positioned correctly when the input position is below the bottom of screen" | ||
| ) |
There was a problem hiding this comment.
This test suite is for VerticalCandidateController, but the test testPositioning1 instantiates and tests HorizontalCandidateController. This appears to be a copy-paste error from HorizontalCandidateControllerTests.swift. As a result, the positioning logic for VerticalCandidateController is not being tested by this case. The controller should be instantiated as VerticalCandidateController().
| @Test( | ||
| "Test if candidate controller can be positioned correctly when the input position is over the top of screen" | ||
| ) |
There was a problem hiding this comment.
Pull request overview
This PR applies swift-format to the CandidateUI package to ensure consistent code formatting across the codebase. Additionally, it removes the now-unnecessary platforms specification from Package.swift (aligning with other packages) and exposes the CandidateKeyLabel initializer to Objective-C for OpenVanilla compatibility.
- Automatic formatting changes applied via swift-format throughout the package
- Removal of
platforms: [.macOS(.v10_15)]from Package.swift (consistent with other packages) - Addition of
@objcattribute toCandidateKeyLabel.init()for OpenVanilla interoperability
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Packages/CandidateUI/Package.swift | Removed platforms specification and applied formatting (trailing comma removal) |
| Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift | Added @objc to init method and applied formatting to function signatures and property initializations |
| Packages/CandidateUI/Sources/CandidateUI/HorizontalCandidateController.swift | Applied formatting to method signatures, line breaks, and range operators |
| Packages/CandidateUI/Sources/CandidateUI/VerticalCandidateController.swift | Applied formatting to method signatures, line breaks, range operators, and multi-line expressions |
| Packages/CandidateUI/Tests/CandidateUITests/HorizontalCandidateControllerTests.swift | Applied formatting to test method signatures and assertions |
| Packages/CandidateUI/Tests/CandidateUITests/VerticalCandidateControllerTests.swift | Applied formatting to test method signatures and assertions |
Also, expose one init with @objc and remove min version
No other packages still specify
platforms, and also make oneinitmethod@objcso that the code can be shared with OpenVanilla.