aui icon indicating copy to clipboard operation
aui copied to clipboard

Fix MkDocs example engine showing unrelated macro aliases

Open luadebug opened this issue 2 months ago • 9 comments

The Python parser was incorrectly adding AUI_DECLARATIVE_FOR to the highlight tokens for ALL examples, regardless of the symbol being documented. This caused examples with AUI_WITH_STYLE to show AUI_DECLARATIVE_FOR highlighting when documenting PropertyListRecursive.

Changes:

  • Added _MACRO_ALIASES map to define macro-to-symbol relationships
  • Created _add_relevant_macro_aliases() helper function
  • Function only adds macro aliases when:
    1. The macro appears in the snippet AND
    2. The macro relates to the tokens being documented
  • Replaced all 5 hardcoded AUI_DECLARATIVE_FOR checks with the new helper
  • Added support for AUI_WITH_STYLE ↔ PropertyListRecursive mapping

This ensures macro aliases are only highlighted in relevant examples, fixing the issue where unrelated macros were being highlighted.

luadebug avatar Nov 01 '25 15:11 luadebug

Summary of Changes

Hello @luadebug, I'm Gemini Code Assist[^1]! 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 resolves an issue in the MkDocs example engine where macro aliases were being highlighted indiscriminately across all code examples, leading to inaccurate and confusing documentation. By introducing a structured mapping of macros to their canonical symbols and implementing a new function to conditionally add these aliases, the system now ensures that only macros relevant to the documented content are highlighted. This significantly improves the precision and clarity of code examples within the documentation.

Highlights

  • Problem Addressed: The MkDocs example engine was incorrectly highlighting the AUI_DECLARATIVE_FOR macro in all examples, even when it was unrelated to the documented symbol. This was particularly noticeable in examples for PropertyListRecursive, which incorrectly showed AUI_DECLARATIVE_FOR highlighting instead of AUI_WITH_STYLE.
  • New Macro Alias Mapping: Introduced a new _MACRO_ALIASES dictionary to explicitly define relationships between macro aliases (e.g., AUI_DECLARATIVE_FOR, AUI_WITH_STYLE) and their canonical symbol names (e.g., AForEachUI, PropertyListRecursive).
  • Intelligent Macro Alias Addition: Implemented a helper function, _add_relevant_macro_aliases(), which intelligently adds macro aliases to the list of highlight tokens. This function ensures that a macro is only added if it appears within the code snippet AND is relevant to the symbols currently being documented.
  • Refactoring Existing Logic: Replaced all five instances of hardcoded conditional logic for adding AUI_DECLARATIVE_FOR to highlight tokens with calls to the new _add_relevant_macro_aliases() helper function, centralizing the logic.
  • Expanded Macro Support: Added specific mapping for AUI_WITH_STYLE to PropertyListRecursive and ass::PropertyListRecursive, ensuring correct highlighting for these related symbols.
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 :thumbsup: and :thumbsdown: 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.

[^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[bot] avatar Nov 01 '25 15:11 gemini-code-assist[bot]

/gemini review

luadebug avatar Nov 01 '25 15:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 15:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 16:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 16:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 18:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 18:11 luadebug

/gemini review

luadebug avatar Nov 01 '25 18:11 luadebug

Still provides AUI_DECLARATIVE_FOR for unrelated pages. Use search bar

Screenshot_20251103_091055

Alex2772 avatar Nov 03 '25 06:11 Alex2772