Skip to content

Instantly share code, notes, and snippets.

@MrWen33
Last active November 11, 2024 12:28
Show Gist options
  • Save MrWen33/7b20ee520f28d73280c27309c1fcf23d to your computer and use it in GitHub Desktop.
Save MrWen33/7b20ee520f28d73280c27309c1fcf23d to your computer and use it in GitHub Desktop.
.code-workspace template file for vscode clangd to work on unreal engine project
// Author: @MrWen33
//
// 0. Install Clang and add to your PATH
//
// 1. Replace "{YourUnrealEnginePath}" to your unreal engine absolute path.
// Replace "{YourProjectName}" to your project name
// Replace "{YourUprojectPath}" to your .uproject file absolute path
//
// 2. Open this file with vscode and run task "GenCompileCommands"
//
// 3. enjoy coding!
//
{
"folders": [
{
"name": "{YourProjectName}",
"path": "."
},
{
"name": "UE4",
"path": "{YourUnrealEnginePath}"
}
],
"settings": {
"typescript.tsc.autoDetect": "off",
"C_Cpp.intelliSenseEngine": "Disabled",
"C_Cpp.autocomplete": "Disabled",
"C_Cpp.errorSquiggles": "Disabled",
"clangd.arguments": [
"--background-index",
"--compile-commands-dir=.vscode",
"-pretty",
"--clang-tidy",
"-j=12",
"--header-insertion=iwyu",
"--all-scopes-completion",
"--completion-style=detailed",
"--pch-storage=memory"
]
},
"extensions": {
"recommendations": [
"ms-vscode.cpptools",
"ms-dotnettools.csharp",
"llvm-vs-code-extensions.vscode-clangd"
]
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Gen Generated Code",
"group": "none",
"command": "Engine\\Binaries\\DotNET\\UnrealBuildTool.exe",
"args": [
"{YourProjectName}Editor",
"Win64",
"DebugGame",
"-SkipBuild",
"-project={YourUprojectPath}",
"-game",
"-engine"
],
"type": "shell",
"options": {
"cwd": "{YourUnrealEnginePath}"
}
},
{
"label": "Subtask:GenClangDatabase",
"group": "none",
"command": "Engine\\Binaries\\DotNET\\UnrealBuildTool.exe",
"args": [
"{YourProjectName}Editor",
"Win64",
"DebugGame",
"-SkipBuild",
"-project={YourUprojectPath}",
"-game",
"-engine",
"-mode=GenerateClangDatabase"
],
"type": "shell",
"options": {
"cwd": "{YourUnrealEnginePath}"
}
},
{
"label": "Subtask:MoveCompileCommands",
"group": "none",
"command": "move",
"args": [
"compile_commands.json",
"${workspaceFolder}/.vscode/compile_commands.json"
],
"type": "shell",
"options": {
"cwd": "{YourUnrealEnginePath}"
}
},
{
"label": "Gen Compile Commands",
"group": "none",
"dependsOn": ["Subtask:GenClangDatabase", "Subtask:MoveCompileCommands"],
"dependsOrder": "sequence"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment