|
|
@@ -22,6 +22,137 @@ After completing the installation of the plugin, restart VSCode to see the statu
|
|
|
|
|
|
You can set the platform, architecture, compilation mode, tool-chain and other options in the status bar, and then click Build to start the build.
|
|
|
|
|
|
+### Debugging Support
|
|
|
+
|
|
|
+The xmake-vscode plugin provides comprehensive breakpoint debugging support with multiple debugger types:
|
|
|
+
|
|
|
+#### Debugger Types
|
|
|
+- **default**: Automatically select appropriate debugger (CodeLLDB on macOS, GDB on other platforms)
|
|
|
+- **codelldb**: Use CodeLLDB debugger (recommended for macOS)
|
|
|
+- **lldb-dap**: Use official LLVM LLDB DAP debugger
|
|
|
+- **gdb-dap**: Use GDB DAP debugger (requires C/C++ extension)
|
|
|
+
|
|
|
+#### Debug Environment Requirements
|
|
|
+
|
|
|
+**Required VSCode Extensions:**
|
|
|
+- **CodeLLDB**: For macOS and Linux debugging (install `vadimcn.vscode-lldb`)
|
|
|
+- **C/C++**: For GDB DAP debugging support (install `ms-vscode.cpptools`)
|
|
|
+- **LLDB DAP**: For official LLDB debugging (install `llvm-vs-code-extensions.lldb-dap`)
|
|
|
+
|
|
|
+**System Debugger Requirements:**
|
|
|
+- **macOS**: Need Xcode Command Line Tools (includes `lldb` command)
|
|
|
+- **Linux**: Need `gdb` or `lldb` debugger installed
|
|
|
+- **Windows**: Need Visual Studio Build Tools or MinGW-w64 (includes `gdb`)
|
|
|
+
|
|
|
+**Installation Commands:**
|
|
|
+```bash
|
|
|
+# macOS
|
|
|
+xcode-select --install
|
|
|
+
|
|
|
+# Ubuntu/Debian
|
|
|
+sudo apt install gdb
|
|
|
+
|
|
|
+# CentOS/RHEL
|
|
|
+sudo yum install gdb
|
|
|
+
|
|
|
+# Windows (using Chocolatey)
|
|
|
+choco install gdb
|
|
|
+```
|
|
|
+
|
|
|
+#### Debug Configuration
|
|
|
+The xmake-vscode plugin automatically generates debug configuration and passes it to the debugger, so users don't need to manually create `launch.json`.
|
|
|
+
|
|
|
+If you need to override internal debug configuration, you can use `xmake.customDebugConfig` setting:
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.customDebugConfig": {
|
|
|
+ "stopAtEntry": false,
|
|
|
+ "args": ["--custom-arg"],
|
|
|
+ "env": {
|
|
|
+ "CUSTOM_ENV": "value"
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+### Configuration Options
|
|
|
+
|
|
|
+The plugin supports rich configuration options that can be configured in VSCode settings:
|
|
|
+
|
|
|
+#### Basic Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.executable": "xmake",
|
|
|
+ "xmake.logLevel": "normal",
|
|
|
+ "xmake.buildLevel": "normal",
|
|
|
+ "xmake.runMode": "runOnly"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### Path Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.buildDirectory": "${workspaceRoot}/build",
|
|
|
+ "xmake.installDirectory": "",
|
|
|
+ "xmake.packageDirectory": "",
|
|
|
+ "xmake.workingDirectory": "${workspaceRoot}",
|
|
|
+ "xmake.compileCommandsDirectory": ".vscode"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### Toolchain Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.androidNDKDirectory": "",
|
|
|
+ "xmake.QtDirectory": "",
|
|
|
+ "xmake.WDKDirectory": ""
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### IntelliSense Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.compileCommandsBackend": "clangd",
|
|
|
+ "xmake.autoGenerateCompileCommands": "onFileChange",
|
|
|
+ "xmake.compileCommandsDirectory": ".vscode",
|
|
|
+ "xmake.enableSyntaxCheck": true
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+> **Tip**: For detailed explanation of these configuration options (such as auto-generation mode, generation path, etc.), please jump to the [Configure IntelliSense](#intellisense) section below.
|
|
|
+
|
|
|
+#### Debug Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.debugConfigType": "default",
|
|
|
+ "xmake.debuggingTargetsArguments": {
|
|
|
+ "default": ["--debug"],
|
|
|
+ "mytarget": ["--arg1", "--arg2"]
|
|
|
+ },
|
|
|
+ "xmake.runningTargetsArguments": {
|
|
|
+ "default": []
|
|
|
+ },
|
|
|
+ "xmake.envBehaviour": "merge"
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### Status Bar Configuration
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.status.showProject": false,
|
|
|
+ "xmake.status.showXMake": true,
|
|
|
+ "xmake.status.showPlatform": false,
|
|
|
+ "xmake.status.showArch": false,
|
|
|
+ "xmake.status.showMode": false,
|
|
|
+ "xmake.status.showToolchain": false,
|
|
|
+ "xmake.status.showTarget": false,
|
|
|
+ "xmake.status.showBuild": true,
|
|
|
+ "xmake.status.showRun": true,
|
|
|
+ "xmake.status.showDebug": true
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
### Custom options
|
|
|
|
|
|
If these options are not enough, you can create .vscode/settings.json and write the settings required by xmake, such as:
|
|
|
@@ -38,7 +169,7 @@ If these options are not enough, you can create .vscode/settings.json and write
|
|
|
|
|
|
Other xmake options can also be set in settings.json. After modification, the configuration can be refreshed through the >XMake: Configure command.
|
|
|
|
|
|
-### Configure Intellsence
|
|
|
+### Configure IntelliSense {#intellisense}
|
|
|
|
|
|
For a better C++ syntax prompt experience, xmake provides support for [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP for short).
|
|
|
|
|
|
@@ -52,9 +183,9 @@ In addition, in order to support intellisense, xmake provides compile_commands.j
|
|
|
|
|
|
Usually after modifying xmake.lua and clicking Save, the xmake-vscode plugin will trigger the automatic generation of compile_commands.json, which is stored in the .vscode directory by default.
|
|
|
|
|
|
-This is also the recommended way. Usually after installing the xmake-vscode plugin and opening the project with xmake.lua, you only need to edit xmake.lua to save and trigger without any other additional operations.
|
|
|
+This is also the recommended way. Usually after installing the xmake-vscode plugin and opening the project with xmake.lua, you only need to edit xmake.lua to save and trigger, without any other additional operations.
|
|
|
|
|
|
-##### Manually trigger generation
|
|
|
+##### Manual trigger generation
|
|
|
|
|
|
Of course, if we don't see the file being generated, we can also use the `>XMake: UpdateIntellisense` command to manually trigger the generation of .vscode/compile_commands.json in VSCode.
|
|
|
|
|
|
@@ -65,8 +196,8 @@ Alternatively, we can also use this rule to automatically update and generate co
|
|
|
```lua
|
|
|
add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode"})
|
|
|
target("test")
|
|
|
- set_kind("binary")
|
|
|
- add_files("src/*.c")
|
|
|
+ set_kind("binary")
|
|
|
+ add_files("src/*.c")
|
|
|
```
|
|
|
|
|
|
This will automatically update this file after each build.
|
|
|
@@ -79,7 +210,16 @@ If the above methods are invalid, we can also execute the command to generate it
|
|
|
$ xmake project -k compile_commands .vscode
|
|
|
```
|
|
|
|
|
|
-#### vscode-cpptools
|
|
|
+#### IntelliSense Configuration
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "xmake.compileCommandsBackend": "clangd",
|
|
|
+ "xmake.autoGenerateCompileCommands": "onFileChange",
|
|
|
+ "xmake.compileCommandsDirectory": ".vscode",
|
|
|
+ "xmake.enableSyntaxCheck": true
|
|
|
+}
|
|
|
+```
|
|
|
|
|
|
If we use the vscode-cpptools plugin to provide intellisense support, we need to go to the VSCode plugin marketplace first, search for C++, and install the default first plugin.
|
|
|
|
|
|
@@ -156,21 +296,25 @@ Also, since the compile_commands.json generated by XMake is in the .vscode direc
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-## Sublime Plugin
|
|
|
+## Intellij IDEA/CLion Plugin
|
|
|
|
|
|
-* [xmake-sublime](https://github.com/xmake-io/xmake-sublime)
|
|
|
+* [xmake-idea](https://github.com/xmake-io/xmake-idea)
|
|
|
|
|
|
-<img src="https://raw.githubusercontent.com/xmake-io/xmake-sublime/master/res/problem.gif" width="650px" />
|
|
|
+<img src="https://raw.githubusercontent.com/xmake-io/xmake-idea/master/res/problem.gif" width="650px" />
|
|
|
|
|
|
-## Intellij IDEA/Clion Plugin
|
|
|
+**CLion 2025.3+ New Feature**: Supports lldb/gdb-dap debugging, allowing you to debug Xmake projects directly without needing to generate `CMakeLists.txt` as a workaround. You can set breakpoints, step through code, and view variable values.
|
|
|
|
|
|
-* [xmake-idea](https://github.com/xmake-io/xmake-idea)
|
|
|
+Debug configuration interface:
|
|
|
|
|
|
-<img src="https://raw.githubusercontent.com/xmake-io/xmake-idea/master/res/problem.gif" width="650px" />
|
|
|
+<img src="/assets/img/posts/xmake/xmake-idea-dap-debug-conf.png" width="650px" />
|
|
|
|
|
|
-## Vim Plugin
|
|
|
+Runtime debugging interface:
|
|
|
|
|
|
-* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
|
|
|
+<img src="/assets/img/posts/xmake/xmake-idea-dap-debug-run.png" width="650px" />
|
|
|
+
|
|
|
+Additionally, the plugin now supports automatic updating of `compile_commands.json` to improve C++ code completion and highlighting experience.
|
|
|
+
|
|
|
+<img src="/assets/img/posts/xmake/xmake-idea-update-compd.png" width="650px" />
|
|
|
|
|
|
## Neovim Plugin
|
|
|
|
|
|
@@ -180,6 +324,78 @@ The plugin provides an easy-to-use configuration UI and auto-generation of *comp
|
|
|
|
|
|
<img src="https://raw.githubusercontent.com/Mythos-404/xmake.nvim/main/assets/XmakePreview.gif" width="650px" />
|
|
|
|
|
|
+## Zed Editor Plugin
|
|
|
+
|
|
|
+* [xmake-zed](https://github.com/xmake-io/xmake-zed)
|
|
|
+
|
|
|
+[Zed](https://zed.dev/) is a high-performance, multiplayer code editor, and xmake provides plugin support for it.
|
|
|
+
|
|
|
+### Plugin installation
|
|
|
+
|
|
|
+The Zed editor plugin provides seamless integration with xmake, offering features like:
|
|
|
+
|
|
|
+- Project configuration and build management
|
|
|
+- Real-time build status and error reporting
|
|
|
+- IntelliSense support through compile_commands.json generation
|
|
|
+- Quick access to common xmake commands
|
|
|
+
|
|
|
+> **Note**: The plugin is currently being submitted to the official Zed marketplace and is pending review ([PR #4565](https://github.com/zed-industries/extensions/pull/4565)). In the meantime, you can install it locally:
|
|
|
+
|
|
|
+#### Local Installation
|
|
|
+
|
|
|
+1. Clone the plugin repository:
|
|
|
+ ```sh
|
|
|
+ git clone https://github.com/xmake-io/xmake-zed.git
|
|
|
+ ```
|
|
|
+
|
|
|
+2. Load the extension in Zed:
|
|
|
+ - Open Zed editor
|
|
|
+ - Go to `Zed > Extensions`
|
|
|
+ - Click `Load Extension` and select the cloned `xmake-zed` directory
|
|
|
+
|
|
|
+#### Marketplace Installation (Future Support)
|
|
|
+
|
|
|
+Once the official review is approved, you'll be able to install it directly from the Zed marketplace by going to `Zed > Extensions`, then search for `xmake` and install the official plugin.
|
|
|
+
|
|
|
+### Usage
|
|
|
+
|
|
|
+After installation, the plugin will automatically detect xmake projects and provide:
|
|
|
+
|
|
|
+- **Full LSP Support**: Code completion, diagnostics, hover info, code actions, symbol navigation, and formatting via xmake_ls
|
|
|
+- **Syntax Highlighting**: Support for 300+ XMake API functions
|
|
|
+- **Project Templates**: 25+ project templates covering 15 programming languages
|
|
|
+- **Auto-installation**: Automatically downloads and installs xmake_ls language server
|
|
|
+
|
|
|
+> **Tip**: The plugin will automatically download and install the xmake_ls language server, no manual configuration required.
|
|
|
+
|
|
|
+### Configuration
|
|
|
+
|
|
|
+The plugin supports the following main configuration options:
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "lsp": {
|
|
|
+ "xmake-ls": {
|
|
|
+ "settings": {
|
|
|
+ "linuxVariant": "auto",
|
|
|
+ "logLevel": "Info",
|
|
|
+ "enableDiagnostics": true,
|
|
|
+ "enableCompletion": true,
|
|
|
+ "enableHover": true,
|
|
|
+ "enableCodeActions": true,
|
|
|
+ "xmakePath": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Key options:
|
|
|
+- **linuxVariant**: Linux binary variant (auto/musl/x64 etc.)
|
|
|
+- **logLevel**: Log level (Error/Warning/Info/Debug/Trace)
|
|
|
+- **enableDiagnostics/Completion/Hover/CodeActions**: Enable/disable features
|
|
|
+- **xmakePath**: Path to xmake executable
|
|
|
+
|
|
|
## Gradle Plugin (JNI)
|
|
|
|
|
|
* [xmake-gradle](https://github.com/xmake-io/xmake-gradle): A gradle plugin that integrates xmake seamlessly
|
|
|
@@ -331,3 +547,13 @@ $ ./gradlew app:assembleDebug
|
|
|
```sh
|
|
|
$ ./gradlew nativelib:xmakeRebuild
|
|
|
```
|
|
|
+
|
|
|
+## Sublime Plugin
|
|
|
+
|
|
|
+* [xmake-sublime](https://github.com/xmake-io/xmake-sublime)
|
|
|
+
|
|
|
+<img src="https://raw.githubusercontent.com/xmake-io/xmake-sublime/master/res/problem.gif" width="650px" />
|
|
|
+
|
|
|
+## Vim Plugin
|
|
|
+
|
|
|
+* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
|