|
|
@@ -0,0 +1,64 @@
|
|
|
+
|
|
|
+[VSCode](https://code.visualstudio.com/)is a commonly used text editor, and xmake provides plug-ins' support.
|
|
|
+
|
|
|
+## Plugin installation
|
|
|
+
|
|
|
+Since VSCode itself only provides text editing functions, we need to install plug-ins to support configuration, compilation, debugging, intellisenses and other functions:
|
|
|
+
|
|
|
+* XMake
|
|
|
+* C/C++
|
|
|
+* CodeLLDB
|
|
|
+
|
|
|
+After completing the installation of the plug-in, restart VSCode to see the status bar below:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+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.
|
|
|
+
|
|
|
+## Custom options
|
|
|
+
|
|
|
+If these options are not enough, you can create .vscode/settings.json and write the settings required by xmake, such as:
|
|
|
+
|
|
|
+```
|
|
|
+{
|
|
|
+...
|
|
|
+ "xmake.additionalConfigArguments": [
|
|
|
+ "--my_option=true"
|
|
|
+ ],
|
|
|
+...
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Other xmake options can also be setted in settings.json. After modification, the configuration can be refreshed through the >XMake: Configure command.
|
|
|
+
|
|
|
+## Improve the development experience with LSP
|
|
|
+
|
|
|
+For a better C++ intellisense experience, xmake provides support for [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP for short). In vscode, you can use the >XMake: UpdateIntellisense command to generate .vscode/compile_commands.json (usually when modifying xmake.lua, this file will be generated automatically). At the same time, we can choose to install a intellisense plug-in that supports LSP, such as [clangd](https://clangd.llvm.org/) published by LLVM, which is stable and efficient, and support different tool-chain through the LSP standard.
|
|
|
+
|
|
|
+When using clangd, there may be conflicts with the C/C++ plug-in, you can add settings in .vscode/settings.json:
|
|
|
+
|
|
|
+```
|
|
|
+{
|
|
|
+ "C_Cpp.codeAnalysis.runAutomatically": false,
|
|
|
+ "C_Cpp.intelliSenseEngine": "Disabled",
|
|
|
+ "C_Cpp.formatting": "Disabled",
|
|
|
+ "C_Cpp.autoAddFileAssociations": false,
|
|
|
+ "C_Cpp.autocompleteAddParentheses": false,
|
|
|
+ "C_Cpp.autocomplete": "Disabled",
|
|
|
+ "C_Cpp.errorSquiggles": "Disabled",
|
|
|
+...
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+Also, since the compile_commands.json generated by XMake is in the .vscode directory, you need to set the clangd parameter to look for it in the correct location:
|
|
|
+
|
|
|
+```
|
|
|
+{
|
|
|
+ "clangd.arguments": [
|
|
|
+ "--compile-commands-dir=.vscode",
|
|
|
+...
|
|
|
+ ]
|
|
|
+...
|
|
|
+}
|
|
|
+```
|
|
|
+
|