Skip to content

Conversation

@xuhuanzy
Copy link
Member

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @xuhuanzy, 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 undertakes a substantial refactoring of the hover functionality within the codebase. The primary goal is to enhance the accuracy and contextual relevance of hover information, particularly for function definitions and calls involving generic types. By restructuring the function hover logic and improving generic type inference, the changes aim to provide users with more precise and helpful insights into their code.

Highlights

  • Refactored Hover Function Logic: The core logic for building hover information for functions has been significantly refactored. The old function_humanize.rs module has been replaced by a new function/mod.rs module, which introduces a more structured approach to processing function types, handling overloads, and managing generic instantiation.
  • Improved Generic Type Inference for Hovers: The hover builder now includes a mechanism to infer a TypeSubstitutor based on the context of the hovered token. This enhancement allows for more accurate and context-aware display of generic function types, especially when hovering over function calls.
  • Simplified TplContext Structure: The root field has been removed from the TplContext structure, simplifying its design and usage in generic type instantiation processes.
  • Enhanced LuaFunctionType::is_method Logic: The is_method check within LuaFunctionType has been updated to consider str_tpl_ref types, leading to more precise detection of methods, particularly for string template references.
  • Dynamic Semantic Declaration Adjustment: New helper functions, adjust_semantic_decls and has_add_to_semantic_decls, have been introduced in build_hover.rs. These functions intelligently manage the list of semantic declarations, ensuring that the most relevant type is prioritized, duplicates are handled, and specific cases like table field assignments within function calls are correctly processed.
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

@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 refactors the hover functionality, particularly for functions, to improve handling of generics and overloads. The changes include creating a new function module to house the hover logic, removing the old function_humanize module, and updating the HoverBuilder to support better generic type substitution. While the refactoring is a good step forward, I've identified a few areas for improvement. There are some minor code cleanup opportunities, like removing unused code and attributes. More importantly, there seems to be a regression in type inference for generic functions that take closures as arguments, leading to less precise hover information.

@CppCXY CppCXY merged commit d97e3b2 into EmmyLuaLs:main Oct 21, 2025
22 checks passed
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