├── LICENSE ├── README.md └── vscode-unreal-snippets.code-snippets /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jordan Abbatiello 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vscode-unreal-snippets 2 | Unreal Engine snippets based on https://github.com/awforsythe/sublime-unreal-snippets 3 | 4 | --- 5 | # Getting Started 6 | 7 | 8 | ### Option 1 9 | 1. Download vscode-unreal-snippets.code-snippets. 10 | 11 | 2. Add vscode-unreal-snippets.code-snippets to .vscode directory of your project 12 | 13 | 14 | ### Option 2 15 | 1. Download vscode-unreal-snippets.code-snippets. 16 | 17 | 2. Inside of VS Code go to ***File*** > ***Preferences*** > ***User Snippets*** > ***New Global Snippets file*** 18 | 19 | 3. Paste the contents of vscode-unreal-snippets.code-snippets. -------------------------------------------------------------------------------- /vscode-unreal-snippets.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Unreal Class Actor": { 3 | "prefix": "uca", 4 | "body": [ 5 | "#pragma once", 6 | "", 7 | "#include \"CoreMinimal.h\"", 8 | "#include \"GameFramework/Actor.h\"", 9 | "", 10 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.generated.h\"", 11 | "", 12 | "UCLASS()", 13 | "class A${TM_FILENAME/([^\\.]+)\\..*/$1/} : public AActor", 14 | "{", 15 | "\tGENERATED_BODY()", 16 | "", 17 | "public:", 18 | "\t$1", 19 | "};" 20 | ], 21 | "description": "Unreal Class Actor" 22 | }, 23 | "Unreal Class Component": { 24 | "prefix": "ucc", 25 | "body": [ 26 | "#pragma once", 27 | "", 28 | "#include \"CoreMinimal.h\"", 29 | "#include \"Components/ActorComponent.h\"", 30 | "", 31 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.generated.h\"", 32 | "", 33 | "UCLASS()", 34 | "class U${TM_FILENAME/([^\\.]+)\\..*/$1/} : public UActorComponent", 35 | "{", 36 | "\tGENERATED_BODY()", 37 | "", 38 | "public:", 39 | "\t$1", 40 | "};" 41 | ], 42 | "description": "Unreal Class Component" 43 | }, 44 | "Unreal Class Interface": { 45 | "prefix": "uci", 46 | "body": [ 47 | "#pragma once", 48 | "", 49 | "#include \"CoreMinimal.h\"", 50 | "#include \"UObject/Interface.h\"", 51 | "", 52 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.generated.h\"", 53 | "", 54 | "UINTERFACE()", 55 | "class ${TM_FILEPATH/.*\\/Source\\/(.*)\\/(?:Private|Public)\\/.*/\\U$1/}_API U${TM_FILENAME/([^\\.]+)\\..*/$1/} : public UInterface", 56 | "{", 57 | "\tGENERATED_BODY()", 58 | "};", 59 | "", 60 | "class ${TM_FILEPATH/.*\\/Source\\/(.*)\\/(?:Private|Public)\\/.*/\\U$1/}_API I${TM_FILENAME/([^\\.]+)\\..*/$1/}", 61 | "{", 62 | "\tGENERATED_BODY()", 63 | "", 64 | "public:", 65 | "\t$1", 66 | "};" 67 | ], 68 | "description": "Unreal Class Interface" 69 | }, 70 | "Unreal Class Object": { 71 | "prefix": "uco", 72 | "body": [ 73 | "#pragma once", 74 | "", 75 | "#include \"CoreMinimal.h\"", 76 | "#include \"UObject/Object.h\"", 77 | "", 78 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.generated.h\"", 79 | "", 80 | "UCLASS()", 81 | "class U${TM_FILENAME/([^\\.]+)\\..*/$1/} : public UObject", 82 | "{", 83 | "\tGENERATED_BODY()", 84 | "", 85 | "public:", 86 | "\t$1", 87 | "};" 88 | ], 89 | "description": "Unreal Class Object" 90 | }, 91 | "Unreal Class Statics": { 92 | "prefix": "ucs", 93 | "body": [ 94 | "#pragma once", 95 | "", 96 | "#include \"CoreMinimal.h\"", 97 | "#include \"Kismet/BlueprintFunctionLibrary.h\"", 98 | "", 99 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.generated.h\"", 100 | "", 101 | "UCLASS()", 102 | "class U${TM_FILENAME/([^\\.]+)\\..*/$1/} : public UBlueprintFunctionLibrary", 103 | "{", 104 | "\tGENERATED_BODY()", 105 | "", 106 | "public:", 107 | "\t$1", 108 | "};" 109 | ], 110 | "description": "Unreal Class Statics" 111 | }, 112 | "Unreal Function Constructor": { 113 | "prefix": "ufc", 114 | "body": [ 115 | "${1:_}${TM_FILENAME/([^\\.]+)\\..*/$1/}(const FObjectInitializer& ObjectInitializer);" 116 | ], 117 | "description": "Unreal Function Constructor" 118 | }, 119 | "Unreal Function Interface": { 120 | "prefix": "ufi", 121 | "body": [ 122 | "virtual void ${1:SomeFunction}() = 0;" 123 | ], 124 | "description": "Unreal Function Interface" 125 | }, 126 | "Unreal Function Replicated": { 127 | "prefix": "ufr", 128 | "body": [ 129 | "void A${TM_FILENAME/([^\\.]+)\\..*/$1/}::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const", 130 | "{", 131 | "\tSuper::GetLifetimeReplicatedProps(OutLifetimeProps);", 132 | "", 133 | "\tDOREPLIFETIME(A${TM_FILENAME/([^\\.]+)\\..*/$1/}, ${1:SomeProperty});", 134 | "}" 135 | ], 136 | "description": "Unreal Function Replicated" 137 | }, 138 | "Unreal Function Static": { 139 | "prefix": "ufs", 140 | "body": [ 141 | "UFUNCTION(BlueprintCallable, Category=\"${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}\", meta=(WorldContext=\"WorldContextObject\"))", 142 | "static ${2:void} ${1:SomeFunction}(UObject* WorldContextObject);" 143 | ], 144 | "description": "Unreal Function Static" 145 | }, 146 | "Unreal Function": { 147 | "prefix": "uff", 148 | "body": [ 149 | "UFUNCTION(BlueprintCallable, Category=\"${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}\")", 150 | "${2:void} ${1:SomeFunction}();" 151 | ], 152 | "description": "Unreal Function" 153 | }, 154 | "Unreal Log Cpp": { 155 | "prefix": "ulc", 156 | "body": [ 157 | "#include \"Log.h\"", 158 | "", 159 | "DEFINE_LOG_CATEGORY(Log${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/});", 160 | "" 161 | ], 162 | "description": "Unreal Log Cpp" 163 | }, 164 | "Unreal Log Fatal": { 165 | "prefix": "ulf", 166 | "body": [ 167 | "UE_LOG(Log${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}, Fatal, TEXT(\"${1:Fatal error}\"));" 168 | ], 169 | "description": "Unreal Log Fatal" 170 | }, 171 | "Unreal Log Header": { 172 | "prefix": "ulh", 173 | "body": [ 174 | "#pragma once", 175 | "", 176 | "#include \"Logging/LogMacros.h\"", 177 | "", 178 | "DECLARE_LOG_CATEGORY_EXTERN(Log${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}, All, All);", 179 | "" 180 | ], 181 | "description": "Unreal Log Header" 182 | }, 183 | "Unreal Log Line": { 184 | "prefix": "ull", 185 | "body": [ 186 | "UE_LOG(Log${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}, Log, TEXT(\"Hello\");" 187 | ], 188 | "description": "Unreal Log Line" 189 | }, 190 | "Unreal Macro Export": { 191 | "prefix": "ume", 192 | "body": [ 193 | "${TM_FILEPATH/.*\\/Source\\/(.*)\\/(?:Private|Public)\\/.*/\\U$1/}_API" 194 | ], 195 | "description": "Unreal Macro Export" 196 | }, 197 | "Unreal Module Build": { 198 | "prefix": "umb", 199 | "body": [ 200 | "using UnrealBuildTool;", 201 | "", 202 | "public class ${TM_FILENAME/([^\\.]+)\\..*/$1/} : ModuleRules", 203 | "{", 204 | "\tpublic ${TM_FILENAME/([^\\.]+)\\..*/$1/}(ReadOnlyTargetRules Target) : base(Target)", 205 | "\t{", 206 | "\t\tPCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;", 207 | "\t\tbEnforceIWYU = true;", 208 | "", 209 | "\t\tPublicDependencyModuleNames.AddRange(new string[] { \"Core\", \"CoreUObject\", \"Engine\" });", 210 | "\t\tPrivateDependencyModuleNames.AddRange(new string[] { });", 211 | "\t}", 212 | "}" 213 | ], 214 | "description": "Unreal Module Build" 215 | }, 216 | "Unreal Module Cpp Primary": { 217 | "prefix": "umcp", 218 | "body": [ 219 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.h\"", 220 | "#include \"Modules/ModuleManager.h\"", 221 | "", 222 | "#include \"Log.h\"", 223 | "", 224 | "void F${TM_FILENAME/([^\\.]+)\\..*/$1/}::StartupModule()", 225 | "{", 226 | "\tUE_LOG(Log${TM_FILENAME/([^\\.]+)\\..*/$1/}, Log, TEXT(\"${TM_FILENAME/([^\\.]+)\\..*/$1/} module starting up\"));", 227 | "}", 228 | "", 229 | "void F${TM_FILENAME/([^\\.]+)\\..*/$1/}::ShutdownModule()", 230 | "{", 231 | "\tUE_LOG(Log${TM_FILENAME/([^\\.]+)\\..*/$1/}, Log, TEXT(\"${TM_FILENAME/([^\\.]+)\\..*/$1/} module shutting down\"));", 232 | "}", 233 | "", 234 | "IMPLEMENT_PRIMARY_GAME_MODULE(F${TM_FILENAME/([^\\.]+)\\..*/$1/}, ${TM_FILENAME/([^\\.]+)\\..*/$1/}, \"${TM_FILENAME/([^\\.]+)\\..*/$1/}\");", 235 | "" 236 | ], 237 | "description": "Unreal Module Cpp Primary" 238 | }, 239 | "Unreal Module Cpp": { 240 | "prefix": "umc", 241 | "body": [ 242 | "#include \"${TM_FILENAME/([^\\.]+)\\..*/$1/}.h\"", 243 | "#include \"Modules/ModuleManager.h\"", 244 | "", 245 | "#include \"Log.h\"", 246 | "", 247 | "void F${TM_FILENAME/([^\\.]+)\\..*/$1/}::StartupModule()", 248 | "{", 249 | "\tUE_LOG(Log${TM_FILENAME/([^\\.]+)\\..*/$1/}, Log, TEXT(\"${TM_FILENAME/([^\\.]+)\\..*/$1/} module starting up\"));", 250 | "}", 251 | "", 252 | "void F${TM_FILENAME/([^\\.]+)\\..*/$1/}::ShutdownModule()", 253 | "{", 254 | "\tUE_LOG(Log${TM_FILENAME/([^\\.]+)\\..*/$1/}, Log, TEXT(\"${TM_FILENAME/([^\\.]+)\\..*/$1/} module shutting down\"));", 255 | "}", 256 | "", 257 | "IMPLEMENT_GAME_MODULE(F${TM_FILENAME/([^\\.]+)\\..*/$1/}, ${TM_FILENAME/([^\\.]+)\\..*/$1/});" 258 | ], 259 | "description": "Unreal Module Cpp" 260 | }, 261 | "Unreal Module Header": { 262 | "prefix": "umh", 263 | "body": [ 264 | "#pragma once", 265 | "", 266 | "#include \"CoreMinimal.h\"", 267 | "#include \"Modules/ModuleInterface.h\"", 268 | "", 269 | "class F${TM_FILENAME/([^\\.]+)\\..*/$1/} : public IModuleInterface", 270 | "{", 271 | "public:", 272 | "\tstatic inline F${TM_FILENAME/([^\\.]+)\\..*/$1/}& Get()", 273 | "\t{", 274 | "\t\treturn FModuleManager::LoadModuleChecked(\"${TM_FILENAME/([^\\.]+)\\..*/$1/}\");", 275 | "\t}", 276 | "", 277 | "\tstatic inline bool IsAvailable()", 278 | "\t{", 279 | "\t\treturn FModuleManager::Get().IsModuleLoaded(\"${TM_FILENAME/([^\\.]+)\\..*/$1/}\");", 280 | "\t}", 281 | "", 282 | "\tvirtual void StartupModule() override;", 283 | "\tvirtual void ShutdownModule() override;", 284 | "};" 285 | ], 286 | "description": "Unreal Module Header" 287 | }, 288 | "Unreal Module Target": { 289 | "prefix": "umt", 290 | "body": [ 291 | "using UnrealBuildTool;", 292 | "", 293 | "public class ${TM_FILENAME/([^\\.]+)\\..*/$1/}Target : TargetRules", 294 | "{", 295 | "\tpublic ${TM_FILENAME/([^\\.]+)\\..*/$1/}Target(TargetInfo Target) : base(Target)", 296 | "\t{", 297 | "\t\tType = TargetType.Game;", 298 | "\t\tDefaultBuildSettings = BuildSettingsVersion.V2;", 299 | "\t\tExtraModuleNames.AddRange( new string[] { \"$1\" } );", 300 | "\t}", 301 | "}" 302 | ], 303 | "description": "Unreal Module Target" 304 | }, 305 | "Unreal Property Component": { 306 | "prefix": "upc", 307 | "body": [ 308 | "UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=\"Components\")", 309 | "${2:class USceneComponent*} ${1:SomeComponent};" 310 | ], 311 | "description": "Unreal Property Component" 312 | }, 313 | "Unreal Property Editable": { 314 | "prefix": "upe", 315 | "body": [ 316 | "UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=\"${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}\")", 317 | "${2:int32} ${1:SomeProperty};" 318 | ], 319 | "description": "Unreal Property Editable" 320 | }, 321 | "Unreal Property Visible": { 322 | "prefix": "upv", 323 | "body": [ 324 | "UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=\"${TM_FILEPATH/.*Source[\\\\\\/]([^\\\\/]+)[\\\\\\/](?:Private|Public).*/$1/}\")", 325 | "${2:int32} ${1:SomeProperty};" 326 | ], 327 | "description": "Unreal Property Visible" 328 | }, 329 | "Unreal Uproject": { 330 | "prefix": "uuproj", 331 | "body": [ 332 | "{", 333 | "\t\"FileVersion\": 3,", 334 | "\t\"EngineAssociation\": \"${2:4.25}\",", 335 | "\t\"Category\": \"\",", 336 | "\t\"Description\": \"\",", 337 | "\t\"Modules\": [", 338 | "\t\t{", 339 | "\t\t\t\"Name\": \"$1\",", 340 | "\t\t\t\"Type\": \"Runtime\",", 341 | "\t\t\t\"LoadingPhase\": \"Default\"", 342 | "\t\t}", 343 | "\t]", 344 | "}" 345 | ], 346 | "description": "Unreal Uproject" 347 | } 348 | } --------------------------------------------------------------------------------