-
Notifications
You must be signed in to change notification settings - Fork 60
doc: Add doc for xmake cdb generation #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdded detailed Xmake instructions to the Quick Start docs (English and Chinese) describing how to generate a compilation database ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. Comment |
There was a problem hiding this 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
📒 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.
| ### 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`. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
-
The
--lsp=clangdflag is valid and was added in v2.7.5, but the trailingbuildargument appears non-standard. The standard command isxmake project -k compile_commandswithout a positional directory argument. -
The
xmake.compileCommandsDirectorysetting 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, useadd_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>"}).
Added documentation for generating compilation database in Xmake. See XMake Doc for reference.
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.