This tool parses the .dep file of a Keil MDK project to extract the compilation commands used in the project, which are then used to generate a `compile_commands.json` file. Therefore, if the project has not been compiled before using this tool, it is best to first compile the project with Keil to generate the latest .dep file. The generated `compile_commands.json` can be used with clangd or ccls to enable LSP (Language Server Protocol) functionality in the editor.
This tool parses the .uvproj file of a Keil MDK project to extract the files used in the project, which are then used to generate a `compile_commands.json` file. The generated `compile_commands.json` can be used with clangd or ccls to enable LSP (Language Server Protocol) functionality in the editor.
Ensure that the current Keil MDK project is located within a git repository. If not, initialize a git repository in the project’s root directory using the following command:
git init👿 Note: The git directory should ideally contain both the Keil MDK project and the source code.
Open a terminal and run the following command:
python gen_compile_commands_json.pyWindows users can open cmd or PowerShell to run the command, or simply double-click the script to execute it. However, running it via double-click will not display debug information.