Skip to content

Comments

feat: code action for wrapping block in figure with caption#2367

Open
QuadnucYard wants to merge 7 commits intoMyriad-Dreamin:mainfrom
QuadnucYard:figure-action
Open

feat: code action for wrapping block in figure with caption#2367
QuadnucYard wants to merge 7 commits intoMyriad-Dreamin:mainfrom
QuadnucYard:figure-action

Conversation

@QuadnucYard
Copy link
Contributor

Supports:

  • functions: image, table, raw (matched by name only)
  • code blocks and content blocks
  • raw
before after
image image
image image

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @QuadnucYard, 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 enhances the code action capabilities by introducing a new refactoring option to wrap selected content in a figure with a caption. This feature streamlines the process of creating structured and captioned elements in documents, improving both the authoring experience and the semantic richness of the output. It intelligently handles various block types and provides flexible caption placement.

Highlights

  • New Code Action: Wrap in Figure with Caption: Introduces a new code action that allows users to wrap various content blocks within a figure environment, automatically adding a caption.
  • Supported Content Types: This code action supports image, table, and raw function calls, as well as generic code blocks, content blocks, and raw blocks.
  • Caption Placement Options: Provides two options for the caption placement: either before or after the content within the figure function.
  • Context-Aware Raw Block Handling: For raw blocks, the action intelligently determines if a hash prefix (#) is needed for the figure function based on whether the raw block is in markup or math mode.
  • Localization Updates: Adds new localization strings for the newly introduced code actions, supporting both English and Chinese.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

Copy link
Contributor

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

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 introduces a new code action feature that allows users to wrap various block types (function calls like image, table, raw, code blocks, content blocks, and raw blocks) within a figure environment, with options to place the caption before or after the content. The implementation correctly handles different syntax kinds and determines whether a hash prefix is needed for raw blocks based on context. The new localization strings for these actions are also included. I've identified a couple of areas for improvement regarding snippet cursor placement and minor code clarity. Additionally, I noticed the inclusion of exportHtml and exportPdf localization keys, which seem unrelated to the primary feature of this PR.

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