Skip to content

Run swift-format over the CandidateUI package - #752

Merged
zonble merged 2 commits into
openvanilla:masterfrom
lukhnos:format-candidate-ui
Nov 26, 2025
Merged

Run swift-format over the CandidateUI package#752
zonble merged 2 commits into
openvanilla:masterfrom
lukhnos:format-candidate-ui

Conversation

@lukhnos

@lukhnos lukhnos commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Also, expose one init with @objc and remove min version

No other packages still specify platforms, and also make one init method @objc so that the code can be shared with OpenVanilla.

No other packages still specify `platforms`, and also make one `init`
method `@objc` so that the code can be shared with OpenVanilla.
Copilot AI review requested due to automatic review settings November 25, 2025 01:24
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @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

  • Code Formatting: The CandidateUI package has been formatted using swift-format to ensure consistent code style across the codebase, improving readability and maintainability.
  • Objective-C Interoperability: An init method in CandidateKeyLabel has been exposed with the @objc attribute to allow for better interoperability and sharing of code with Objective-C projects, such as OpenVanilla.
  • Package Configuration Streamlining: The minimum platform version specification has been removed from Package.swift, aligning with other packages in the repository that do not explicitly define platforms.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +44 to +46
@Test(
"Test if candidate controller can be positioned correctly when the input position is below the bottom of screen"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

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().

Comment on lines +62 to +64
@Test(
"Test if candidate controller can be positioned correctly when the input position is over the top of screen"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Similar to the test above, testPositioning2 instantiates HorizontalCandidateController instead of VerticalCandidateController. The test name and file name suggest that VerticalCandidateController should be tested here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 @objc attribute to CandidateKeyLabel.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

@zonble
zonble merged commit d22ac01 into openvanilla:master Nov 26, 2025
14 checks passed
@lukhnos
lukhnos deleted the format-candidate-ui branch January 11, 2026 00:52
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.

3 participants