├── .eslintrc.json ├── .gitignore ├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── jsconfig.json ├── package.json └── src ├── buildtool.js ├── command.js ├── cpptools.js ├── debug.js ├── editor.js ├── extension.js ├── misc.js ├── tasks.js └── util.js /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": false, 4 | "commonjs": true, 5 | "es6": true, 6 | "node": true 7 | }, 8 | "parserOptions": { 9 | "ecmaFeatures": { 10 | "jsx": true 11 | }, 12 | "sourceType": "module" 13 | }, 14 | "rules": { 15 | "no-const-assign": "warn", 16 | "no-this-before-super": "warn", 17 | "no-undef": "warn", 18 | "no-unreachable": "warn", 19 | "no-unused-vars": "warn", 20 | "constructor-super": "warn", 21 | "valid-typeof": "warn" 22 | } 23 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | TODO -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Extension", 9 | "type": "extensionHost", 10 | "request": "launch", 11 | "runtimeExecutable": "${execPath}", 12 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], 13 | "stopOnEntry": false 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | test/** 4 | .gitignore 5 | jsconfig.json 6 | vsc-extension-quickstart.md 7 | .eslintrc.json 8 | TODO 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | v0.1.2 4 | ------ 5 | Added setting *engineVersion* for 4.18 compatibility 6 | 7 | Fixed project file generation for 4.18 using *engineVersion* setting 8 | 9 | v0.1.1 10 | ------ 11 | Fixed Generate Task Configurations command will now display error messages 12 | 13 | v0.1.0 14 | ------ 15 | 16 | Added Generate Debug Configurations command. Running the command will update launch.json with debug configurations: 17 | * *configurationName* : Attach Editor *Project* [GameDebug Editor] 18 | * *configurationName* : Launch Editor *Project* [GameDebug Editor] 19 | * *configurationName* : Launch *Project* [GameDebug Editor] 20 | 21 | Added Generate Task Configurations command. Running the command will update tasks.json with task configurations: 22 | * *configurationName* : Generate *Project* Project Files 23 | * *configurationName* : Open *Project* With Editor 24 | * *configurationName* : Run *Project* With Editor 25 | * *configurationName* : Launch Unreal Editor 26 | * *configurationName* : Build *Project* [*buildConfigurations* *buildConfigurationTargets*] 27 | * *configurationName* : Clean *Project* [*buildConfigurations* *buildConfigurationTargets*] 28 | * *configurationName* : Rebuild *Project* [*buildConfigurations* *buildConfigurationTargets*] 29 | 30 | Added settings: 31 | * *configurationName* - name for task, debug, and cppTools configurations 32 | * *buildConfigurations* - build configurations to generate task configurations for 33 | * *buildConfigurationTargets* - build configuration targets to generate task configurations for 34 | 35 | Removed settings: 36 | * *buildConfiguration* - use *buildConfigurations* 37 | * *buildConfigurationTarget* - use *buildConfigurationTargets* 38 | * *cppToolsConfiguration* - use *configuratinName* 39 | * *recycleTerminal* - removed terminal related stuff 40 | * *buildPlatform* - current platform only 41 | 42 | Other: 43 | * Removed terminal related stuff 44 | * Bumped minimum vscode version to 1.15 45 | * Added intermediate include paths to generated cppTool configuration 46 | * Added default system configuration to generated cppTool configuration 47 | 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Christopher Reed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ue4-cpptools 2 | ============ 3 | [https://github.com/christopherreed/ue4-cpptools](https://github.com/christopherreed/ue4-cpptools) 4 | 5 | __WARNING - USE AT YOUR OWN RISK!__ 6 | 7 | This is an **unofficial** extension and it is not affiliated in any way with Epic Games. This extension shouldn't be used in a production environment. Things will probably change and/or break regulary. 8 | 9 | [VSCode](https://code.visualstudio.com/) extension that provides tools for working with Unreal Engine 4 C++ projects. 10 | 11 | You may want to check out [VSCodeSourceCodeAccess](https://github.com/christopherreed/VSCodeSourceCodeAccess), an Unreal Engine 4 plugin that provides source code access for working with C++ projects using VSCode. 12 | 13 | 14 | 15 | Unreal Engine 4.18 16 | ------------------ 17 | Unreal Engine 4.18 ships with official VSCode support. 18 | 19 | **Future development of this extension will halt and become maintenance and bug fixes only.** 20 | 21 | The extension will be removed from the VSCode extension marketplace once the official support makes it redundant. The github repo will remain avaialble for use with pre 4.18 versions of Unreal Engine. 22 | 23 | Install 24 | ------- 25 | 26 | 1) [Download](https://github.com/christopherreed/ue4-cpptools/releases) this extension as a .vsix package. 27 | 28 | 2) Install the .vsix package. [[?]](https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix) 29 | 30 | 3) Set *ue4-cpptools.engineVersion* to "4.18" if you are using Unreal Engine version 4.18 31 | 32 | 4) Set *ue4-cpptools.engineRootPath* and any additional settings you need to configure the extension for you workspace. [[?]](https://code.visualstudio.com/docs/getstarted/settings) 33 | 34 | > **engineRootPath is required** and should point to the root folder for the engine version you are using (*.../Epic Games/UE_4.17*). This folder should include **Engine / FeaturePacks / Samples / Templates** sub folders. 35 | 36 | 5) For C++ language support, debug support, and IntelliSense install [CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension. 37 | 38 | Edit your project 39 | ---- 40 | Setup: 41 | 42 | 1) Install [CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension. This provides support for c++ language and IntelliSense. 43 | 44 | 2) Run **Generate CppTools Configuration**. This will generate [CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) configuration for your project. [[?]](https://code.visualstudio.com/docs/languages/cpp) 45 | 46 | 3) Run **Generate Task Configurations**. This will generate editor tasks for your project. 47 | 48 | Command **Search Unreal Engine Online Documentation** : Search Unreal Engine Online Documentation for selected text. 49 | 50 | Task **Open *Project* With Editor [*Development/GameDebug* *Editor*]** : Open build of your project with Unreal Editor. 51 | 52 | Task **Run *Project* With Editor [*Development/GameDebug* *Editor*]** : Run build of your project with Unreal Editor. 53 | 54 | Task **Launch Unreal Editor** : Launch Unreal Editor 55 | 56 | Build your project 57 | ----- 58 | Setup: 59 | 60 | 1) Run **Generate Task Configurations**. This will generate build tasks for your project. [[?]](https://docs.unrealengine.com/latest/INT/Programming/Development/CompilingProjects/index.html) 61 | 62 | > The generated build task configurations matrix is determined by the settings **buildConfigurations** and **buildConfigurationTargets** 63 | 64 | 2) Customize tasks. [[?]](https://code.visualstudio.com/docs/editor/tasks#_custom-tasks) 65 | 66 | 3) Run tasks. [[?]](https://code.visualstudio.com/docs/editor/tasks) 67 | 68 | Task **Generate *Project* Project Files** : Generate project files for your project. [[?]](https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html) 69 | 70 | Task **Build *Project* [*buildConfigurations* *buildConfigurationTargets*]** Build your project. 71 | 72 | Task **Clean *Project* [*buildConfigurations* *buildConfigurationTargets*]** Clean your project. 73 | 74 | Task **Rebuild *Project* [*buildConfigurations* *buildConfigurationTargets*]** Clean and build your project. 75 | 76 | Debug your project 77 | ----- 78 | Setup: 79 | 80 | 1) Install [CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension. This provides support for c++ debuggers. [[?]](https://code.visualstudio.com/docs/languages/cpp#_debugging) 81 | 82 | 2) Run **Generate Debug Configurations**. This will generate [CppTools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) launch configurations for your project. 83 | 84 | 3) Customize configurations. [[?]](https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md) 85 | 86 | 4) Debug with the [VSCode](https://code.visualstudio.com/) integrated debugger. [[?]](https://code.visualstudio.com/docs/editor/debugging) 87 | 88 | Debug **Attach Editor *Project* [GameDebug Editor]** : Attach debug session to open editor. 89 | 90 | > Editor must be opened with *[GameDebug Editor]* build of your project. 91 | 92 | Debug **Launch Editor *Project* [GameDebug Editor]** : Launch editor debug session. 93 | 94 | Debug **Launch *Project* [GameDebug Editor]** : Launch debug session without open editor. 95 | 96 | Advanced Settings *(you probably shouldn't touch these)* 97 | ----------------- 98 | 99 | __ue4-cpptools.overrideUnrealBuildTool__ : Advanced - Override the command to run Unreal Build Tool. 100 | 101 | __ue4-cpptools.overrideUnrealEditor__ : Advanced - Override the command to run Unreal Editor. 102 | 103 | Known Issues 104 | ------------ 105 | 106 | [https://github.com/christopherreed/ue4-cpptools/issues](https://github.com/christopherreed/ue4-cpptools/issues) 107 | 108 | * Mac untested - implemenations are 'best guess' at the moment 109 | 110 | * Generate CppTools Configuration will only include default system configuration if it is present in c_cpp_properties.json at generation time 111 | 112 | * Generate CppTools Configuration will only include intermediate include paths if the folders are present at generation time 113 | 114 | * Relies on the Unreal Build Tool CodeLite project generator 115 | 116 | License 117 | ------- 118 | 119 | This software is licensed under the MIT License, see LICENSE for more information 120 | 121 | Buy Me a Coffee at ko-fi.com 122 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "lib": [ 6 | "es6" 7 | ] 8 | }, 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ue4-cpptools", 3 | "displayName": "ue4-cpptools", 4 | "description": "VSCode Tools for working with Unreal Engine 4 C++ projects", 5 | "version": "0.1.2", 6 | 7 | "publisher": "christopherreed", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/christopherreed/ue4-cpptools" 11 | }, 12 | "bugs" : { 13 | "url" : "https://github.com/christopherreed/ue4-cpptools/issues" 14 | }, 15 | "license": "MIT", 16 | "readme" : "README.md", 17 | "engines": { 18 | "vscode": "^1.15.0" 19 | }, 20 | "categories": [ 21 | "Other" 22 | ], 23 | "activationEvents": [ 24 | "onCommand:ue4-cpptools.generateCppToolsConfiguration", 25 | "onCommand:ue4-cpptools.searchOnlineDocumentation", 26 | "onCommand:ue4-cpptools.generateTaskConfigurations", 27 | "onCommand:ue4-cpptools.generateDebugConfigurations" 28 | ], 29 | "main": "./src/extension", 30 | "contributes": { 31 | "commands": [ 32 | { 33 | "command": "ue4-cpptools.generateCppToolsConfiguration", 34 | "title": "Generate CppTools Configuration", 35 | "category": "UE4 Tools" 36 | }, 37 | { 38 | "command": "ue4-cpptools.searchOnlineDocumentation", 39 | "title": "Search Unreal Engine Online Documenation", 40 | "category": "UE4 Tools" 41 | }, 42 | { 43 | "command": "ue4-cpptools.generateTaskConfigurations", 44 | "title": "Generate Task Configurations", 45 | "category": "UE4 Tools" 46 | }, 47 | { 48 | "command": "ue4-cpptools.generateDebugConfigurations", 49 | "title": "Generate Debug Configurations", 50 | "category": "UE4 Tools" 51 | } 52 | ], 53 | "configuration": { 54 | "type": "object", 55 | "title": "UE4 CppTools Configuration", 56 | "properties": { 57 | "ue4-cpptools.engineRootPath": { 58 | "type": "string", 59 | "description": "Path to Unreal Engine root directory" 60 | }, 61 | "ue4-cpptools.engineVersion": { 62 | "type": "string", 63 | "description": "Unreal Engine version" 64 | }, 65 | "ue4-cpptools.configurationName": { 66 | "type": "string", 67 | "description": "Name used for generated configurations" 68 | }, 69 | "ue4-cpptools.overrideUnrealBuildTool": { 70 | "type": "string", 71 | "description": "Advanced - Override the command to run Unreal Build Tool" 72 | }, 73 | "ue4-cpptools.buildConfigurations": { 74 | "type" : "array", 75 | "description" : "Unreal Build Tool build configurations to generate tasks for" 76 | }, 77 | "ue4-cpptools.buildConfigurationTargets": { 78 | "type": "array", 79 | "description" : "Unreal Build Tool build configuration targets to generate tasks for" 80 | }, 81 | "ue4-cpptools.overrideUnrealEditor": { 82 | "type": "string", 83 | "description": "Advanced - Override the command to run Unreal Editor" 84 | } 85 | } 86 | } 87 | }, 88 | "scripts": { 89 | "postinstall": "node ./node_modules/vscode/bin/install", 90 | "test": "node ./node_modules/vscode/bin/test" 91 | }, 92 | "devDependencies": { 93 | "typescript": "^2.0.3", 94 | "vscode": "^1.0.0", 95 | "mocha": "^2.3.3", 96 | "eslint": "^3.6.0", 97 | "@types/node": "^6.0.40", 98 | "@types/mocha": "^2.2.32" 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/buildtool.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | const util = require('./util.js'); 5 | const command = require('./command.js'); 6 | 7 | function getUnrealBuildToolCommand(info) { 8 | return new Promise((resolve, reject) => { 9 | let engineRootPath = info.engineRootPath; 10 | 11 | if (!engineRootPath) { 12 | reject('Invalid or unset ue4-cpptools.engineRootPath'); 13 | } else { 14 | let unrealBuildTool = path.join(engineRootPath, 'Engine', 'Binaries', 'DotNET', 'UnrealBuildTool.exe'); 15 | 16 | fs.access(unrealBuildTool, (err) => { 17 | if (err) { 18 | reject(`Failed to access Unreal Build Tool '${unrealBuildTool}' : ${err}`); 19 | } else { 20 | resolve(unrealBuildTool); 21 | } 22 | }); 23 | } 24 | }); 25 | } 26 | 27 | function getBuildCommand(info, args) { 28 | return new Promise((resolve, reject) => { 29 | let overrideUnrealBuildTool = info.overrideUnrealBuildTool; 30 | 31 | if (overrideUnrealBuildTool) { 32 | resolve({'command':overrideUnrealBuildTool, 'args':args}); 33 | } else { 34 | getUnrealBuildToolCommand(info).then((command) => { 35 | if (process.platform == 'linux' || process.platform == 'darwin') { 36 | // Linux and Mac requires us to prepend 'mono' 37 | args.unshift(command); 38 | command = 'mono'; 39 | } 40 | 41 | resolve({'command':command, 'args':args}); 42 | }, (err) => { 43 | reject(err); 44 | }); 45 | } 46 | }); 47 | } 48 | exports.getBuildCommand = getBuildCommand; 49 | 50 | function getBuildProjectArgs(info, buildConfiguration, buildConfigurationTarget, buildPlatform) { 51 | if (!buildPlatform) { 52 | buildPlatform = info.buildPlatform; 53 | } 54 | 55 | if(!buildConfiguration) { 56 | buildConfiguration = 'Development'; 57 | } 58 | 59 | if (buildConfigurationTarget == 'Game' || buildConfigurationTarget == 'Executable') { 60 | buildConfigurationTarget = ''; // For forcing the 'empty' stand-alone game executable target 61 | } else if (!buildConfigurationTarget) { 62 | buildConfigurationTarget = 'Editor'; 63 | } 64 | 65 | let args = [ 66 | info.projectName + buildConfigurationTarget, 67 | buildPlatform, 68 | buildConfiguration, 69 | info.projectFilePath, 70 | '-waitmutex' 71 | ]; 72 | 73 | return args; 74 | } 75 | exports.getBuildProjectArgs = getBuildProjectArgs; 76 | 77 | function getGenerateProjectFilesArgs(info, generateNativeProjectFiles=true, generateCodeLiteProjectFiles=false, generateEngineProjectFiles=true) { 78 | let args = []; 79 | 80 | if (generateNativeProjectFiles) { 81 | let nativeProjectFiles = { // TODO setting ue4-cpptool.nativeProjectFiles 82 | 'linux' : ['-makefile', '-kdevelopfile', '-qmakefile', '-cmakefile', '-codelitefile'], 83 | 'win32' : ['-projectfiles'], 84 | 'darwin' : ['-xcodeprojectfile'] 85 | }; 86 | 87 | args = args.concat(nativeProjectFiles[process.platform]); 88 | } 89 | 90 | if (generateCodeLiteProjectFiles) { 91 | if (!args.find((v) => {return v == '-codelitefile'})) args.push('-codelitefile'); 92 | } 93 | 94 | // 4.18+ compatibility 95 | if (!info.engineVersion || info.engineVersion.startsWith('4.16') || info.engineVersion.startsWith('4.17')) { 96 | args.push('-project='); 97 | } else { 98 | // 4.18 renamed arg to -codelitefiles 99 | args = args.map(arg => arg == '-codelitefile' ? '-codelitefiles' : arg); 100 | } 101 | 102 | args = args.concat([ 103 | info.projectFilePath, 104 | '-game', 105 | '-rocket', 106 | '-waitmutex' 107 | ]); 108 | 109 | if (generateEngineProjectFiles) { 110 | args.push('-engine'); 111 | } 112 | 113 | return args; 114 | } 115 | exports.getGenerateProjectFilesArgs = getGenerateProjectFilesArgs; 116 | 117 | function execGenerateProjectFilesProcess(generateNativeProjectFiles=false, generateCodeLiteProjectFiles=false, generateEngineProjectFiles=false) { 118 | return new Promise((resolve, reject) => { 119 | util.getProjectInfo().then((info) => { 120 | let args = getGenerateProjectFilesArgs(info, generateNativeProjectFiles, generateCodeLiteProjectFiles, generateEngineProjectFiles); 121 | 122 | getBuildCommand(info, args).then((buildCommand) => { 123 | command.execCommandInProcess(buildCommand.command, buildCommand.args).then( 124 | (ok) => { 125 | resolve(); 126 | },(err) => { 127 | reject(`Failed to generate project files : Exited with error code ${err}`); 128 | }); 129 | }).catch((err) => { 130 | reject(err); 131 | }); 132 | }); 133 | }); 134 | } 135 | exports.execGenerateProjectFilesProcess = execGenerateProjectFilesProcess; -------------------------------------------------------------------------------- /src/command.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const child_process = require('child_process'); 3 | 4 | // Enclose string in quotes if it contains a space char 5 | function fixStringWithSpaces(str) { 6 | if (str.includes(' ')) return `"${str}"`; 7 | return str; 8 | } 9 | 10 | function buildArgsString(args) { 11 | let commandStr = ''; 12 | args.forEach((val) => { 13 | let str = val.toString(); 14 | 15 | commandStr = commandStr.concat(fixStringWithSpaces(str) + ' '); 16 | }); 17 | 18 | return commandStr; 19 | } 20 | 21 | function execCommandInProcess(command, args) { 22 | return new Promise((resolve, reject) => { 23 | let commandStr = fixStringWithSpaces(command) + ' ' + buildArgsString(args); 24 | 25 | child_process.exec(commandStr, (err) => { 26 | if (err) { 27 | if (err.code) { 28 | reject(err.code); 29 | } else { 30 | resolve(undefined); // ignore errors, without an error code - probably a killed process 31 | } 32 | } else { 33 | resolve(0); 34 | } 35 | }); 36 | }); 37 | } 38 | exports.execCommandInProcess = execCommandInProcess; -------------------------------------------------------------------------------- /src/cpptools.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const readline = require('readline'); 4 | const vscode = require('vscode'); 5 | const util = require('./util.js') 6 | const buildtool = require('./buildtool.js'); 7 | 8 | function generateCppToolsIncludePathFromCodeLiteProject(info) { 9 | var completionFilename = path.join(info.projectPath, info.projectName + 'CodeCompletionFolders.txt'); 10 | 11 | return new Promise((resolve, reject) => { 12 | let includePath = []; 13 | 14 | fs.stat(completionFilename, (err, stats) => { 15 | if (err) { 16 | reject(`Error reading file: ${completionFilename}`); 17 | } else { 18 | let reader = readline.createInterface({ 19 | input: fs.createReadStream(completionFilename), 20 | }); 21 | reader.on('line', (line) => {includePath.push(line);}); 22 | reader.on('close', () => {resolve(includePath);}); 23 | } 24 | }); 25 | }); 26 | } 27 | 28 | function generateCppToolsDefinesFromCodeLiteProject(info) { 29 | var definesFilename = path.join(info.projectPath, info.projectName + 'CodeLitePreProcessor.txt'); 30 | 31 | return new Promise((resolve, reject) => { 32 | let defines = []; 33 | 34 | fs.stat(definesFilename, (err, stats) => { 35 | if (err) { 36 | reject(`Error reading file: ${definesFilename}`); 37 | } else { 38 | let reader = readline.createInterface({ 39 | input: fs.createReadStream(definesFilename), 40 | }); 41 | reader.on('line', (line) => {defines.push(line);}); 42 | reader.on('close', () => {resolve(defines);}); 43 | } 44 | }); 45 | }); 46 | } 47 | 48 | function generateCppToolsBrowse(info) { 49 | return new Promise((resolve, reject) => { 50 | let browsePath = [ 51 | '${workspaceRoot}' 52 | ]; 53 | 54 | 55 | if (info.engineRootPath) { 56 | let engineSourcePath = path.join(info.engineRootPath, 'Engine', 'Source'); 57 | browsePath.push(engineSourcePath); 58 | } 59 | 60 | let browse = { 61 | 'limitSymbolsToIncludedHeaders': false, 62 | 'path' : browsePath 63 | }; 64 | 65 | resolve(browse); 66 | }); 67 | } 68 | 69 | function findSubDirsSync(rootPath, dir, results) { 70 | let files = []; 71 | try { 72 | files = fs.readdirSync(rootPath); 73 | } catch (err) { 74 | if (err.code != 'ENOENT') { 75 | throw(err); 76 | } 77 | } 78 | 79 | files.forEach((file) => { 80 | let fullPath = path.join(rootPath, file); 81 | 82 | let stat = fs.statSync(fullPath); 83 | if (stat.isDirectory()) { 84 | if (dir == '*') { 85 | results.push(fullPath); 86 | } else if (dir == file) { 87 | findSubDirsSync(fullPath, '*', results); 88 | } else { 89 | findSubDirsSync(fullPath, dir, results); 90 | } 91 | } 92 | }); 93 | } 94 | 95 | function generateIntermediateIncludePaths(info) { 96 | let intermediatePath = path.join(info.projectPath, 'Intermediate', 'Build', info.buildPlatform); 97 | 98 | return new Promise((resolve, reject) => { 99 | let foundIncPaths = []; 100 | try { 101 | findSubDirsSync(intermediatePath, 'Inc', foundIncPaths); 102 | resolve(foundIncPaths); 103 | } catch (err) { 104 | reject(err); 105 | } 106 | }); 107 | } 108 | 109 | function writeCppToolsPropertiesFile(cppToolsPropertiesFile, config) { 110 | return new Promise((resolve, reject) => { 111 | let json = {}; 112 | 113 | fs.readFile(cppToolsPropertiesFile, (err, data) => { 114 | if (err) { 115 | if (err.code !== 'ENOENT') { 116 | reject(`Failed read '${cppToolsPropertiesFile}' : ${err.code}`); 117 | return; 118 | } 119 | } else { 120 | json = JSON.parse(data); 121 | } 122 | 123 | let configurations = json.configurations || []; 124 | 125 | if (Array.isArray(configurations)) { 126 | let cppToolsDefaultConfigNames = { 127 | 'linux' : 'Linux', 128 | 'win32' : 'Win32', 129 | 'darwin' : 'Mac' 130 | }; 131 | let defaultConfigName = cppToolsDefaultConfigNames[process.platform]; 132 | 133 | let foundConfig; 134 | let foundDefaultConfig; 135 | 136 | configurations.forEach((cfg) => { 137 | if (cfg.name && cfg.name == config.name) { 138 | foundConfig = cfg; 139 | } 140 | 141 | if (cfg.name && cfg.name == defaultConfigName) { 142 | foundDefaultConfig = cfg; 143 | } 144 | }); 145 | 146 | if (foundConfig) { 147 | vscode.window.showInformationMessage(`Skipped overwrite of configuration '${config.name}'`); 148 | resolve(); 149 | } else { 150 | // Append system default config values if present; also from clang -v 151 | if (foundDefaultConfig) { 152 | if (foundDefaultConfig.includePath) { 153 | foundDefaultConfig.includePath.forEach((val) => { 154 | if (config.includePath.indexOf(val) < 0) { 155 | config.includePath.push(val); 156 | } 157 | }); 158 | } 159 | 160 | if (foundDefaultConfig.defines) { 161 | foundDefaultConfig.defines.forEach((val) => { 162 | if (config.defines.indexOf(val) < 0) { 163 | config.defines.push(val); 164 | } 165 | }); 166 | } 167 | 168 | 169 | if (foundDefaultConfig.browse && foundDefaultConfig.browse.path) { 170 | foundDefaultConfig.browse.path.forEach((val) => { 171 | if (config.browse.path.indexOf(val) < 0) { 172 | config.browse.path.push(val); 173 | } 174 | }); 175 | } 176 | } 177 | 178 | configurations.push(config); 179 | 180 | json.configurations = configurations; 181 | json.version = json.version || 3; 182 | 183 | fs.writeFile(cppToolsPropertiesFile, JSON.stringify(json, null, '\t'), {'flag':'w+'}, (err) => { 184 | if (err) { 185 | reject(`Failed to write configuration file '${cppToolsPropertiesFile}' : ${err.code}`); 186 | } else { 187 | resolve(); 188 | } 189 | }); 190 | } 191 | } else { 192 | reject('Invalid configuration file data'); 193 | } 194 | }); 195 | }); 196 | } 197 | 198 | function generateCppToolsConfiguration(configName) { 199 | util.getProjectInfo() 200 | .then((info) => { 201 | let vscodePath = path.join(info.projectPath, '.vscode'); 202 | let cppToolsPropertiesFile = path.join(vscodePath, 'c_cpp_properties.json'); 203 | 204 | let configurationName = info.configurationName; 205 | 206 | let config = { 207 | 'name' : configurationName, 208 | 'includePath' : ['${workspaceRoot}'], 209 | 'defines' : [], 210 | 'browse' : {} 211 | }; 212 | 213 | vscode.window.withProgress({'title':'Generate CppTools Configuration', 'location':vscode.ProgressLocation.Window}, (progress) => { 214 | return util.touchDirectory(vscodePath) 215 | 216 | .then(_ => buildtool.execGenerateProjectFilesProcess(false, true, true)) 217 | 218 | .then(_ => generateCppToolsIncludePathFromCodeLiteProject(info)) 219 | .then((includePath) => { 220 | config.includePath = config.includePath.concat(includePath); 221 | }) 222 | 223 | .then(_ => generateIntermediateIncludePaths(info)) 224 | .then((intermediateIncludePaths) => { 225 | config.includePath = config.includePath.concat(intermediateIncludePaths); 226 | }) 227 | 228 | .then(_ => generateCppToolsDefinesFromCodeLiteProject(info)) 229 | .then((defines) => { 230 | config.defines = defines; 231 | }) 232 | 233 | .then(_ => generateCppToolsBrowse(info)) 234 | .then((browse) => { 235 | config.browse = browse; 236 | }) 237 | 238 | .then(_ => writeCppToolsPropertiesFile(cppToolsPropertiesFile, config)) 239 | 240 | .catch((err) => { 241 | vscode.window.showErrorMessage(`Failed to generate configuration : ${err}`); 242 | }) 243 | }); 244 | }); 245 | 246 | } 247 | exports.generateCppToolsConfiguration = generateCppToolsConfiguration; 248 | 249 | -------------------------------------------------------------------------------- /src/debug.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const util = require('./util.js'); 3 | const editor = require('./editor.js'); 4 | 5 | function generateDebugConfigurations() { 6 | util.getProjectInfo().then((info) => { 7 | let systemLiterals = { 8 | 'linux' : 'linux', 9 | 'win32' : 'windows', 10 | 'darwin' : 'osx' 11 | }; 12 | let currentSystem = systemLiterals[process.platform]; 13 | 14 | let args = [ 15 | info.projectFilePath, 16 | '-debug' 17 | ]; 18 | 19 | editor.getEditorCommand(info, args).then((command) => { 20 | let launchCommand = command.command; 21 | let launchArgs = command.args; 22 | let launchConfigs = []; 23 | let launchType = (currentSystem == 'windows') ? 'cppvsdbg' : 'cppdbg'; 24 | 25 | launchConfigs.push({ 26 | 'name': `${info.configurationName} : Attach Editor ${info.projectName} [DebugGame Editor]`, 27 | 'program' : launchCommand, 28 | 'type': launchType, 29 | 'request': 'attach', 30 | 'processId': '${command:pickProcess}' 31 | }); 32 | 33 | launchConfigs.push({ 34 | 'name':`${info.configurationName} : Launch Editor ${info.projectName} [DebugGame Editor]`, 35 | 'program' : launchCommand, 36 | 'type':launchType, 37 | 'args' : launchArgs, 38 | 'request': 'launch', 39 | 'cwd': '${workspaceRoot}' 40 | }); 41 | 42 | launchConfigs.push({ 43 | 'name':`${info.configurationName} : Launch ${info.projectName} [DebugGame Editor]`, 44 | 'program' : launchCommand, 45 | 'type':launchType, 46 | 'args' : launchArgs.concat('-game'), 47 | 'request': 'launch', 48 | 'cwd': '${workspaceRoot}' 49 | }); 50 | 51 | let launchConfiguration = vscode.workspace.getConfiguration('launch'); 52 | 53 | if (!launchConfiguration.has('version')) launchConfiguration.update('version', '0.2.0'); 54 | 55 | let configurations = launchConfiguration.get('configurations') || []; 56 | 57 | let skippedConfigs = 0; 58 | let updatedConfigs = 0; 59 | 60 | launchConfigs.forEach((config) => { 61 | let createConfig = true; 62 | 63 | configurations.forEach((foundConfig) => { 64 | if (foundConfig.name && config.name == foundConfig.name) { 65 | createConfig = false; 66 | 67 | return true; // break 68 | } 69 | }); 70 | 71 | if (createConfig) { 72 | configurations.push(config); 73 | updatedConfigs++; 74 | } else { 75 | skippedConfigs++; 76 | } 77 | }); 78 | 79 | if (updatedConfigs > 0) { 80 | launchConfiguration.update('configurations', configurations); 81 | } 82 | 83 | if (skippedConfigs > 0) { 84 | vscode.window.showInformationMessage(`Generate Debug Configurations skipped overwriting ${skippedConfigs} configurations`); 85 | } 86 | 87 | }); 88 | }); 89 | } 90 | exports.generateDebugConfigurations = generateDebugConfigurations; -------------------------------------------------------------------------------- /src/editor.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | const util = require('./util.js'); 5 | 6 | function getUnrealEditorCommand(info) { 7 | return new Promise((resolve, reject) => { 8 | let engineRootPath = info.engineRootPath; 9 | 10 | if (!engineRootPath) { 11 | reject('Invalid or unset ue4-cpptools.engineRootPath'); 12 | } else { 13 | let platformPaths = { 14 | 'linux' : 'Linux', 15 | 'win32' : 'Win64', 16 | 'darwin' : 'Mac' 17 | }; 18 | let platformPath = platformPaths[process.platform]; 19 | 20 | let executablePaths = { 21 | 'linux' : 'UE4Editor', 22 | 'win32' : 'UE4Editor.exe', 23 | 'darwin' : 'UE4Editor.app' 24 | }; 25 | let executable = executablePaths[process.platform]; 26 | 27 | let unrealEditor = path.join(engineRootPath, 'Engine', 'Binaries', platformPath, executable); 28 | 29 | fs.access(unrealEditor, (err) => { 30 | if (err) { 31 | reject(`Failed to access Unreal Editor '${unrealEditor}' : ${err}`); 32 | } else { 33 | resolve(unrealEditor); 34 | } 35 | }); 36 | } 37 | }); 38 | } 39 | 40 | function getEditorCommand(info, args) { 41 | return new Promise((resolve, reject) => { 42 | let overrideUnrealEditor = info.overrideUnrealEditor; 43 | 44 | if (overrideUnrealEditor) { 45 | resolve({'command':overrideUnrealEditor, 'args':args}); 46 | } else { 47 | getUnrealEditorCommand(info).then((command) => { 48 | if (process.platform == 'darwin') { 49 | // untested 50 | args.unshift('--args'); 51 | args.unshift(command); 52 | command = 'open'; 53 | } 54 | 55 | resolve({'command':command, 'args':args}); 56 | }, (err) => { 57 | reject(err); 58 | }); 59 | } 60 | }); 61 | } 62 | exports.getEditorCommand = getEditorCommand; 63 | -------------------------------------------------------------------------------- /src/extension.js: -------------------------------------------------------------------------------- 1 | // The module 'vscode' contains the VS Code extensibility API 2 | // Import the module and reference it with the alias vscode in your code below 3 | const vscode = require('vscode'); 4 | const cpptools = require('./cpptools.js'); 5 | const buildtool = require('./buildtool.js'); 6 | const editor = require('./editor.js'); 7 | const misc = require('./misc.js'); 8 | const tasks = require('./tasks.js'); 9 | const debug = require('./debug.js'); 10 | 11 | function activate(context) { 12 | 13 | context.subscriptions.push(vscode.commands.registerCommand('ue4-cpptools.generateCppToolsConfiguration', cpptools.generateCppToolsConfiguration)); 14 | context.subscriptions.push(vscode.commands.registerCommand('ue4-cpptools.generateTaskConfigurations', tasks.generateTaskConfigurations)); 15 | context.subscriptions.push(vscode.commands.registerCommand('ue4-cpptools.searchOnlineDocumentation', misc.searchOnlineDocumentation)); 16 | context.subscriptions.push(vscode.commands.registerCommand('ue4-cpptools.generateDebugConfigurations', debug.generateDebugConfigurations)); 17 | } 18 | 19 | exports.activate = activate; 20 | 21 | // this method is called when your extension is deactivated 22 | function deactivate() { 23 | } 24 | exports.deactivate = deactivate; -------------------------------------------------------------------------------- /src/misc.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const util = require('./util.js'); 3 | 4 | function searchOnlineDocumentation() { 5 | let query = undefined; 6 | if (vscode.window.activeTextEditor) { 7 | let selection = vscode.window.activeTextEditor.selection; 8 | if (selection && !selection.isEmpty) { 9 | let selectionText = vscode.window.activeTextEditor.document.getText(selection); 10 | if (!selectionText.includes(' ')) { 11 | query = selectionText; 12 | } 13 | } 14 | } 15 | 16 | vscode.window.showInputBox({'prompt':'Search Unreal Engine Online Documentation', 'value':query}).then((query) => { 17 | if (query !== undefined) { 18 | if (query.length > 0) { 19 | vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(`https://www.unrealengine.com/bing-search?keyword=${query}`)); 20 | } else { 21 | vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://docs.unrealengine.com/latest/INT/')); 22 | } 23 | util.showIndicator(`Search Unreal Engine Online Documentation : ${query ? query : 'Documentation'}`); 24 | } 25 | }); 26 | } 27 | exports.searchOnlineDocumentation = searchOnlineDocumentation; -------------------------------------------------------------------------------- /src/tasks.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const util = require('./util.js'); 3 | const buildtool = require('./buildtool.js'); 4 | const editor = require('./editor.js'); 5 | 6 | function getGenerateProjectFilesTasks(info) { 7 | return new Promise((resolve, reject) => { 8 | // Generate project files tasks 9 | let tasks = []; 10 | 11 | let args = buildtool.getGenerateProjectFilesArgs(info, true, false, true); 12 | buildtool.getBuildCommand(info, args).then((projectFilesCommand) => { 13 | tasks.push({ 14 | 'taskName' : `${info.configurationName} : Generate ${info.projectName} Project Files`, 15 | 'type' : 'process', 16 | 'command' : projectFilesCommand.command, 17 | 'args' : projectFilesCommand.args 18 | }); 19 | 20 | resolve(tasks); 21 | }).catch((err) => { 22 | throw(err); 23 | }); 24 | }); 25 | } 26 | 27 | function getBuildTasks(info, buildConfiguration, buildConfigurationTarget, buildPlatform) { 28 | return new Promise((resolve, reject) => { 29 | // Build, clean, and rebuild tasks for the build configuration matrix 30 | let tasks = []; 31 | 32 | let args = buildtool.getBuildProjectArgs(info, buildConfiguration, buildConfigurationTarget, buildPlatform); 33 | buildtool.getBuildCommand(info, args).then((buildCommand) => { 34 | let buildTaskName = `${info.configurationName} : Build ${info.projectName} [${buildConfiguration} ${buildConfigurationTarget}]`; 35 | let cleanTaskName = `${info.configurationName} : Clean ${info.projectName} [${buildConfiguration} ${buildConfigurationTarget}]`; 36 | let rebuildTaskName = `${info.configurationName} : Rebuild ${info.projectName} [${buildConfiguration} ${buildConfigurationTarget}]`; 37 | 38 | tasks.push({ 39 | 'taskName' : buildTaskName, 40 | 'type' : 'process', 41 | 'group' : 'build', 42 | 'command' : buildCommand.command, 43 | 'args' : buildCommand.args 44 | }); 45 | 46 | tasks.push({ 47 | 'taskName' : cleanTaskName, 48 | 'type' : 'process', 49 | 'group' : 'build', 50 | 'command' : buildCommand.command, 51 | 'args' : buildCommand.args.concat(['-clean']) 52 | }); 53 | 54 | tasks.push({ 55 | 'taskName' : rebuildTaskName, 56 | 'group' : 'build', 57 | 'dependsOn' : [ 58 | cleanTaskName, 59 | buildTaskName 60 | ] 61 | }); 62 | 63 | resolve(tasks); 64 | }).catch((err) => { 65 | reject(err); 66 | }); 67 | }); 68 | } 69 | 70 | function getEditorTasks(info) { 71 | return new Promise((resolve, reject) => { 72 | // Launch, open, and run tasks 73 | let tasks = []; 74 | let args = []; 75 | editor.getEditorCommand(info, args).then((command) => { 76 | tasks.push({ 77 | 'taskName' : `${info.configurationName} : Launch Unreal Editor`, 78 | 'type' : 'process', 79 | 'command' : command.command, 80 | 'args' : command.args 81 | }); 82 | 83 | tasks.push({ 84 | 'taskName' : `${info.configurationName} : Open ${info.projectName} With Editor [Development Editor]`, 85 | 'type' : 'process', 86 | 'command' : command.command, 87 | 'args' : command.args.concat(info.projectFilePath) 88 | }); 89 | 90 | tasks.push({ 91 | 'taskName' : `${info.configurationName} : Open ${info.projectName} With Editor [DebugGame Editor]`, 92 | 'type' : 'process', 93 | 'command' : command.command, 94 | 'args' : command.args.concat([info.projectFilePath, '-debug']) 95 | }); 96 | 97 | tasks.push({ 98 | 'taskName' : `${info.configurationName} : Run ${info.projectName} With Editor [Development Editor]`, 99 | 'type' : 'process', 100 | 'command' : command.command, 101 | 'args' : command.args.concat([info.projectFilePath, '-game']) 102 | }); 103 | 104 | tasks.push({ 105 | 'taskName' : `${info.configurationName} : Run ${info.projectName} With Editor [DebugGame Editor]`, 106 | 'type' : 'process', 107 | 'command' : command.command, 108 | 'args' : command.args.concat([info.projectFilePath, '-game', '-debug']) 109 | }); 110 | 111 | resolve(tasks); 112 | }).catch((err) => { 113 | throw(err); 114 | }) 115 | }); 116 | } 117 | 118 | function generateTaskConfigurations() { 119 | util.getProjectInfo().then((info) => { 120 | let generatedTasksGlob = []; 121 | 122 | generatedTasksGlob.push(getGenerateProjectFilesTasks(info)); 123 | generatedTasksGlob.push(getEditorTasks(info)); 124 | 125 | let buildConfigurations = info.buildConfigurations; 126 | let buildConfigurationTargets = info.buildConfigurationTargets; 127 | let buildPlatform = info.buildPlatform; 128 | 129 | buildConfigurations.forEach((buildConfiguration) => { 130 | buildConfigurationTargets.forEach((buildConfigurationTarget) => { 131 | generatedTasksGlob.push(getBuildTasks(info, buildConfiguration, buildConfigurationTarget, buildPlatform)); 132 | }); 133 | }); 134 | 135 | Promise.all(generatedTasksGlob).then((tasksArray) => { 136 | let skippedTasks = 0; 137 | let updatedTasks = 0; 138 | 139 | let tasksConfiguration = vscode.workspace.getConfiguration('tasks'); 140 | 141 | if (!tasksConfiguration.get('version')) { 142 | tasksConfiguration.update('version', '2.0.0'); 143 | } 144 | 145 | let foundTasks = tasksConfiguration.get('tasks') || []; 146 | 147 | tasksArray.forEach((tasks) => { 148 | tasks.forEach((task) => { 149 | let createTask = true; 150 | 151 | foundTasks.forEach((foundTask) => { 152 | if (foundTask.taskName && task.taskName == foundTask.taskName) { 153 | createTask = false; 154 | 155 | return true; // break 156 | } 157 | }); 158 | 159 | if (createTask) { 160 | foundTasks.push(task); 161 | updatedTasks++; 162 | } else { 163 | skippedTasks++; 164 | } 165 | }); 166 | }); 167 | 168 | if (updatedTasks > 0) { 169 | tasksConfiguration.update('tasks', foundTasks); 170 | } 171 | 172 | if (skippedTasks > 0) { 173 | vscode.window.showInformationMessage(`Generate Task Configurations skipped overwriting ${skippedTasks} configurations`); 174 | } 175 | }).catch((err) => { 176 | vscode.window.showErrorMessage(`Generate Task Configurations Failed : ${err}`); 177 | }); 178 | }).catch((err) => { 179 | vscode.window.showErrorMessage(`Generate Task Configurations Failed : ${err}`); 180 | }); 181 | } 182 | exports.generateTaskConfigurations = generateTaskConfigurations; -------------------------------------------------------------------------------- /src/util.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | 5 | function touchDirectory(directoryPath) { 6 | return new Promise((resolve, reject) => { 7 | let dir = path.normalize(directoryPath); 8 | 9 | fs.mkdir(dir, (err) => { 10 | if (err && err.code !== 'EEXIST') { 11 | reject(`Failed to touch directory '${path}' : ${err.code}`); 12 | } else { 13 | resolve(dir); 14 | } 15 | }); 16 | }); 17 | } 18 | exports.touchDirectory = touchDirectory; 19 | 20 | function getProjectInfo() { 21 | return new Promise((resolve, reject) => { 22 | let workspaceFolders = vscode.workspace.workspaceFolders; 23 | 24 | if (!workspaceFolders || !workspaceFolders[0]) { 25 | reject('No workspace folder open'); 26 | return; 27 | } 28 | 29 | let uri = workspaceFolders[0].uri; 30 | if (!uri || !uri.fsPath) { 31 | reject('Invalid workspace folder path'); 32 | return; 33 | } 34 | 35 | let projectPath = uri.fsPath; 36 | 37 | let projectName = projectPath.slice(projectPath.lastIndexOf(path.sep) + 1); 38 | if (!projectName || projectName.length < 1) { 39 | reject('Failed to retrieve project name'); 40 | return; 41 | } 42 | 43 | let projectFileName = projectName + '.uproject'; 44 | 45 | let projectFilePath = path.join(projectPath, projectFileName); 46 | 47 | let engineRootPath = vscode.workspace.getConfiguration('ue4-cpptools').get('engineRootPath') || process.env.UE4_ENGINE_ROOT_PATH; 48 | 49 | let configurationName = vscode.workspace.getConfiguration('ue4-cpptools').get('configurationName'); 50 | if (!configurationName) { 51 | let configurationPlatforms = { 52 | 'win32' : 'UE4-Windows', 53 | 'linux' : 'UE4-Linux', 54 | 'darwin' : 'UE4-Mac' 55 | } 56 | configurationName = configurationPlatforms[process.platform]; 57 | } 58 | 59 | let overrideUnrealBuildTool = vscode.workspace.getConfiguration('ue4-cpptools').get('overrideUnrealBuildTool'); 60 | 61 | let buildConfigurations = vscode.workspace.getConfiguration('ue4-cpptools').get('buildConfigurations'); 62 | if (!buildConfigurations || buildConfigurations.length < 1) { 63 | buildConfigurations = [ 64 | 'Development', 65 | 'DebugGame' 66 | ]; 67 | } 68 | 69 | let buildConfigurationTargets = vscode.workspace.getConfiguration('ue4-cpptools').get('buildConfigurationTargets'); 70 | if (!buildConfigurationTargets || buildConfigurationTargets.length < 1) { 71 | buildConfigurationTargets = [ 72 | 'Editor' 73 | ]; 74 | } 75 | 76 | let buildPlatforms = { 77 | 'linux' : 'Linux', 78 | 'win32' : 'Win64', 79 | 'darwin' : 'Mac' 80 | }; 81 | let buildPlatform = buildPlatforms[process.platform]; 82 | 83 | let overrideUnrealEditor = vscode.workspace.getConfiguration('ue4-cpptools').get('overrideUnrealEditor'); 84 | 85 | // TODO get automatically (ex. from UE4Editor.version) 86 | let engineVersion = vscode.workspace.getConfiguration('ue4-cpptools').get('engineVersion'); 87 | 88 | let info = { 89 | 'projectPath' : projectPath, 90 | 'projectName' : projectName, 91 | 'projectFilePath' : projectFilePath, 92 | 'engineRootPath' : engineRootPath, 93 | 'engineVersion' : engineVersion, 94 | 95 | 'configurationName' : configurationName, 96 | 97 | 'overrideUnrealBuildTool' : overrideUnrealBuildTool, 98 | 99 | 'buildConfigurations' : buildConfigurations, 100 | 101 | 'buildConfigurationTargets' : buildConfigurationTargets, 102 | 103 | 'buildPlatform' : buildPlatform, 104 | 105 | 'overrideUnrealEditor' : overrideUnrealEditor 106 | }; 107 | 108 | resolve(info); 109 | }); 110 | } 111 | exports.getProjectInfo = getProjectInfo; 112 | 113 | function showIndicator(title, duration=2500) { 114 | return vscode.window.withProgress({'title':title, 'location':vscode.ProgressLocation.Window}, (progress) => { 115 | return new Promise((resolve) => { 116 | setInterval(() => { 117 | resolve(); 118 | }, duration); 119 | }); 120 | }); 121 | } 122 | exports.showIndicator = showIndicator; --------------------------------------------------------------------------------