Skip to content

Conversation

@hongjr03
Copy link
Contributor

Enables path completion for string concatenation and let-initialized strings, with a small completion filter refinement. Includes related fixtures/snapshots and minor clippy/fmt touchups.

Depends on #2386.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hongjr03, 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 significantly enhances the path completion capabilities within the system. By introducing advanced type inference for string concatenations, let-initialized variables, destructuring patterns, and for loops, it allows the language server to provide more intelligent and context-aware file path suggestions. The changes also include refinements to how completion items are filtered and inserted, leading to a more precise and helpful completion experience for users.

Highlights

  • Enhanced Path Completion: Introduced path completion for string concatenations (e.g., #include "dir/" + "file.typ") and for strings initialized via let bindings (e.g., #let p = "file.typ"; #include p). This significantly improves the developer experience when working with file paths.
  • Improved Type Inference: The type checker now better infers types for destructuring assignments, elements within for loops, and dictionary keys, especially when they involve constant string values. This leads to more accurate and context-aware completions.
  • Completion Filtering Refinement: A new mechanism has been implemented to filter and strip completion suggestions based on the constant prefix and suffix of concatenated strings, ensuring only relevant and correctly formatted paths are suggested.
  • Structural Changes for Import Expressions: The ImportExpr struct now includes a source field, allowing the system to track the origin expression of an import, which is crucial for contextual path completion.
  • Dynamic Dictionary Key Handling: The type checker can now treat dict.at("key") calls as direct field access (dict.key) when the key is a constant string, improving type resolution for dynamically accessed dictionary members.

🧠 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 is a great enhancement, adding path completion for string concatenations and let-initialized strings. The changes are substantial and well-implemented, touching on various parts of the type checking and completion logic to enable this new feature. The improvements to type inference, especially for propagating path constraints and constant folding, are impressive. The new test fixtures and snapshots provide good coverage for the new functionality. The code quality is high, and I only have one minor suggestion for simplification.

Comment on lines +227 to +230
if !concat_prefix.is_empty() && !label_str.starts_with(concat_prefix.as_str()) {
continue;
}
if !concat_suffix.is_empty() && !label_str.ends_with(concat_suffix.as_str()) {
continue;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

medium

These checks for starts_with and ends_with are redundant. The subsequent strip_prefix and strip_suffix calls already handle these checks by returning None if the prefix/suffix doesn't match, which is then handled by the let ... else { continue; } construct. You can safely remove these initial checks to simplify the code.

@hongjr03 hongjr03 force-pushed the split/04-path-completion-concat branch from 3f13393 to 78dc6cf Compare January 29, 2026 09:51
@hongjr03 hongjr03 force-pushed the split/04-path-completion-concat branch from 78dc6cf to db03c69 Compare January 29, 2026 10:37
@hongjr03 hongjr03 force-pushed the split/04-path-completion-concat branch from db03c69 to 627ca32 Compare January 29, 2026 11:55
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.

1 participant