Skip to content

Conversation

@AQian0
Copy link
Contributor

@AQian0 AQian0 commented Dec 13, 2025

image

It should be

image

Summary by CodeRabbit

  • Documentation
    • Updated JavaScript API usage guide with revised parameter ordering for the kind function, ensuring examples reflect the current API signature.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

Documentation example updated to reflect a public API signature change for the kind function, changing argument order from kind('function', Lang.JavaScript) to kind(Lang.JavaScript, 'function') with corresponding text alignment.

Changes

Cohort / File(s) Summary
Documentation Update
website/guide/api-usage/js-api.md
Updated kind function usage example to reflect new parameter order (moved Lang.JavaScript to first position)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Documentation-only change with straightforward example code update
  • No logic or implementation changes
  • Verify the new parameter order matches the actual API implementation

Poem

🐰 A hop, a skip, the docs align,
Parameters rearranged in line,
JavaScript's place now comes first, you see,
API examples flow in harmony! 📚

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the parameter order in an example function call from kind('function', Lang.JavaScript) to kind(Lang.JavaScript, 'function').
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@HerringtonDarkholme HerringtonDarkholme left a comment

Choose a reason for hiding this comment

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

thanks!

@HerringtonDarkholme HerringtonDarkholme added this pull request to the merge queue Dec 13, 2025
Merged via the queue into ast-grep:main with commit 45b76ba Dec 13, 2025
1 check was pending
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
website/guide/api-usage/js-api.md (1)

128-130: Refactor to avoid variable shadowing of the kind function.

Line 129 shadows the kind function with a variable of the same name (const kind = kind(...)), which can confuse readers of documentation examples. This practice is generally discouraged in educational code.

Consider renaming the variable to something more descriptive:

 let l = Lang.JavaScript         // calling kind function requires Lang
-const kind = kind(l, 'string')  // convert kind name to kind id number
-root.find(kind)                 // returns SgNode of string
+const stringKind = kind(l, 'string')  // convert kind name to kind id number
+root.find(stringKind)            // returns SgNode of string

This makes it clearer that we're converting a kind name to its numeric ID before using it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b84d28b and 4263b88.

📒 Files selected for processing (1)
  • website/guide/api-usage/js-api.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
website/**/*.md

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

website/**/*.md: Documentation should use clear, concise language
Include code examples for concepts in documentation
Test documentation examples in the playground when possible
Maintain consistent formatting across documentation pages

Files:

  • website/guide/api-usage/js-api.md
🔇 Additional comments (1)
website/guide/api-usage/js-api.md (1)

121-121: Parameter order documentation is verified and consistent.

The documentation correctly reflects the updated kind function signature with Lang as the first parameter. Line 121's explanation and the code example on line 129 both use the same parameter order: kind(Lang.JavaScript, 'function').

Note: Line 129 uses const kind = kind(l, 'string'), which shadows the kind function name. Consider renaming the variable to kindId or similar for improved clarity in documentation examples.

@AQian0 AQian0 deleted the fix-example-function-params-order branch December 13, 2025 18:46
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