Skip to content

dql: README - #2647

Merged
xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q
Feb 18, 2026
Merged

dql: README#2647
xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

Copy link
Copy Markdown
Member

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @xushiwei, 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 documentation for the DOM Query Language (DQL) by completely overhauling its README file. The updated documentation aims to provide users with a clear and comprehensive understanding of DQL's capabilities, syntax, and usage across diverse tree-shaped data structures, thereby facilitating easier adoption and more effective utilization of the language within XGo projects.

Highlights

  • Comprehensive Documentation: The dql/README.md has been entirely rewritten to provide a thorough introduction to the DOM Query Language (DQL), detailing its purpose, features, and usage.
  • Core Concepts Explained: Detailed explanations of DQL's core concepts, including NodeSet, child access, filtering, attributes, and methods, are now available to clarify how DQL operates.
  • Syntax and Examples: A comprehensive syntax reference and practical query examples across various domains like JSON, HTML, XGo AST, and File System have been added to illustrate DQL's versatility.
  • Advanced Topics Covered: New sections on error handling, performance optimization through lazy evaluation and caching (_all, _one, _single), and guidelines for implementing custom NodeSet interfaces are included.

🧠 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.

Changelog
  • dql/README.md
    • Rewrote the entire README to introduce DQL, its core concepts, syntax, examples, error handling, performance, and NodeSet implementation details.
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.

@xushiwei
xushiwei merged commit fb0f83f into goplus:main Feb 18, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds a comprehensive README.md for the new DQL feature. The documentation is well-structured and covers the key aspects of DQL. I've found a few inconsistencies and potential errors in the code examples and error definitions, which I've detailed in my comments. Addressing these will improve the clarity and correctness of the documentation for developers using DQL.

Comment thread dql/README.md
stmts := doc.shadowEntry.body.list.*@(self.class == "ExprStmt")

// Extract function names from call expressions
for fn in stmts.x@(self.class == "CallExpr").fun@(self.class == "Ident") {

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.

medium

In the XGo AST example, the field x in stmts.x appears to be a typo. The stmts variable holds a NodeSet of *ast.ExprStmt nodes. The relevant field on ast.ExprStmt that holds the expression is X (capitalized). Using the lowercase x will likely fail. Please correct this to X.

Suggested change
for fn in stmts.x@(self.class == "CallExpr").fun@(self.class == "Ident") {
for fn in stmts.X@(self.class == "CallExpr").fun@(self.class == "Ident") {

Comment thread dql/README.md
}

// Collect all Go source file names
names := [f.$name for f in root.**.file@match("*.go", $name)]

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.

medium

The syntax in this File System example appears to be incorrect. The match function is a method on the fs.NodeSet and should be called with . notation, not with @. It also accepts only one argument (the pattern). The second argument $name is not valid. To fix this, match should be called as a method on the NodeSet.

Suggested change
names := [f.$name for f in root.**.file@match("*.go", $name)]
names := [f.$name for f in root.**.file.match("*.go")]

Comment thread dql/README.md
Comment on lines +415 to +418
var (
ErrNotFound = errors.New("node not found")
ErrMultipleEntities = errors.New("multiple entities found, expected single")
)

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.

medium

The standard errors documented here are inconsistent with their definitions in dql/dql.go. The variable name ErrMultipleEntities should be ErrMultiEntities, and the error messages for both ErrNotFound and ErrMultiEntities are different in the source code. Please update the documentation to reflect the actual implementation to avoid confusion.

Suggested change
var (
ErrNotFound = errors.New("node not found")
ErrMultipleEntities = errors.New("multiple entities found, expected single")
)
var (
ErrNotFound = errors.New("entity not found")
ErrMultiEntities = errors.New("too many entities found")
)

@codecov

codecov Bot commented Feb 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.10%. Comparing base (c0085da) to head (7a97537).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2647   +/-   ##
=======================================
  Coverage   94.10%   94.10%           
=======================================
  Files          32       32           
  Lines        9964     9964           
=======================================
  Hits         9377     9377           
  Misses        419      419           
  Partials      168      168           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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