Skip to content

Conversation

@Stehsaer
Copy link

@Stehsaer Stehsaer commented Nov 24, 2025

Added documentation for generating compilation database in Xmake. See XMake Doc for reference.

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added concrete Xmake compilation-database guidance in Quick Start (English and Chinese), replacing a placeholder with step-by-step command-line and VS Code extension methods, sample configuration snippets, and notes that the generated compilation database must be regenerated after project/config changes.

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

@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Added detailed Xmake instructions to the Quick Start docs (English and Chinese) describing how to generate a compilation database (compile_commands.json) via command-line and via the VSCode Xmake extension, plus notes about manual regeneration and example settings.json.

Changes

Cohort / File(s) Summary
Xmake compilation database docs
docs/en/guide/quick-start.md, docs/zh/guide/quick-start.md
Added guidance for generating compile_commands.json under Xmake: command-line invocation (xmake project -k compile_commands --lsp=clangd build), note that generated database does not auto-update, and VSCode extension method with a settings.json example to set compileCommandsDirectory to the build directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify English/Chinese content parity and translations.
  • Confirm the xmake command syntax and flags are correct.
  • Check the settings.json snippet and build directory references.
  • Ensure placement and headings follow existing doc structure.

Poem

🐰 I hopped through docs with tiny feet,

Added commands both clear and neat,
VSCode or CLI, choose your way,
Regenerate when configs sway,
A little rabbit says: hooray! 🥕

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 'doc: Add doc for xmake cdb generation' accurately describes the main change: adding documentation for Xmake compilation database (cdb) generation, which is confirmed by both file summaries showing new Xmake sections with instructions for generating compile_commands.json.
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

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb2c873 and e0dd476.

📒 Files selected for processing (1)
  • docs/en/guide/quick-start.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/en/guide/quick-start.md

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

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aff090 and cb2c873.

📒 Files selected for processing (2)
  • docs/en/guide/quick-start.md (1 hunks)
  • docs/zh/guide/quick-start.md (1 hunks)
🔇 Additional comments (1)
docs/zh/guide/quick-start.md (1)

64-86: Chinese translation is accurate and well-structured.

The Chinese version properly translates the Xmake documentation guidance with natural phrasing. The section is clear and maintains consistency with the English version. However, the same command syntax and VSCode setting verification needed for the English version also applies here.

The verification queries for the English version (command syntax and VSCode setting name) apply equally to the Chinese translation.

Comment on lines 63 to 86
### Xmake

Use one of the following approaches to generate a compilation database.

#### Command Line

Run the following command to manually generate compilation database.

```bash
xmake project -k compile_commands --lsp=clangd build
```

> Compilation database generated manually doesn't automatically update itself. Re-generate if changes are made to the project.
#### VSCode Extension

The Xmake offical VSCode extension provides autonomous generation of compilation database upon updates on `xmake.lua`. However, it generates the database to `.vscode` directory. Append this setting in `settings.json`:

```json
"xmake.compileCommandsDirectory": "build"
```

to explicitly ask the extension to generate the compilation database in `build`.

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify Xmake command syntax and VSCode extension setting name.

The Xmake section provides two methods for generating compilation databases. Please verify that the command syntax and extension settings are accurate against the official Xmake documentation referenced in the PR.


🌐 Web query:

What is the correct command to generate compile_commands.json in Xmake for clangd LSP?

💡 Result:

Use xmake's project command:

xmake project -k compile_commands

This exports a compile_commands.json (xmake's project/plugin places it in .vscode by default). To make clangd find it, set clangd to use that directory, e.g. add "--compile-commands-dir=.vscode" to clangd arguments. [1][2]


🌐 Web query:

What is the correct VSCode extension setting to configure the compilation database directory in Xmake?

💡 Result:

Use the Xmake default (.vscode) and tell clangd where to find it. In .vscode/settings.json set:

"clangd.arguments": ["--compile-commands-dir=.vscode"]

Xmake generates compile_commands.json into .vscode by default (or you can generate to another dir with xmake project -k compile_commands

/ add_rules(..., {outputdir = ""})). [1][2]

Sources:
[1] Xmake — IDE integration / Generate compile_commands (xmake.io).
[2] Xmake — Configure Intellisense (xmake.io).


I need to conduct additional searches to clarify the exact syntax and VSCode extension setting.

Based on the web search results, I have found issues with both the command syntax and the VSCode extension setting. Let me generate the final rewritten review comment:


Fix Xmake command syntax and remove non-existent VSCode setting.

The command and VSCode extension setting contain inaccuracies:

  1. The --lsp=clangd flag is valid and was added in v2.7.5, but the trailing build argument appears non-standard. The standard command is xmake project -k compile_commands without a positional directory argument.

  2. The xmake.compileCommandsDirectory setting does not exist in official Xmake documentation. For clangd users, configure the clangd parameter in .vscode/settings.json: "clangd.arguments": [ "--compile-commands-dir=.vscode", ... ] Alternatively, use add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode"}) in xmake.lua to automatically update the database.

🤖 Prompt for AI Agents
In docs/en/guide/quick-start.md around lines 63 to 86, the Xmake examples are
incorrect: remove the non-standard trailing "build" positional argument from the
command and drop the non-existent "xmake.compileCommandsDirectory" VSCode
setting. Update the command to the standard form (optionally keep --lsp=clangd
for Xmake >=2.7.5) and replace the bogus VSCode setting guidance with
instructions to either configure clangd in .vscode/settings.json via
"clangd.arguments" (e.g. --compile-commands-dir=<dir>) or configure Xmake to
output autoupdated compile_commands into .vscode via
add_rules("plugin.compile_commands.autoupdate", {outputdir = "<dir>"}).

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