├── .gitignore ├── Config └── FilterPlugin.ini ├── LICENSE ├── README.md ├── Resources └── Icon128.png ├── Source └── VSCodeSourceCodeAccess │ ├── Private │ ├── VSCodeSettings.cpp │ ├── VSCodeSettings.h │ ├── VSCodeSourceCodeAccessModule.cpp │ ├── VSCodeSourceCodeAccessModule.h │ ├── VSCodeSourceCodeAccessor.cpp │ └── VSCodeSourceCodeAccessor.h │ └── VSCodeSourceCodeAccess.Build.cs └── VSCodeSourceCodeAccess.uplugin /.gitignore: -------------------------------------------------------------------------------- 1 | Binaries 2 | Intermediate 3 | Ext 4 | .vscode 5 | TODO 6 | 7 | 8 | -------------------------------------------------------------------------------- /Config/FilterPlugin.ini: -------------------------------------------------------------------------------- 1 | [FilterPlugin] 2 | ; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and 3 | ; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively. 4 | ; 5 | ; Examples: 6 | ; /README.txt 7 | ; /Extras/... 8 | ; /Binaries/ThirdParty/*.dll 9 | 10 | README.md 11 | /Ext/... 12 | -------------------------------------------------------------------------------- /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 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | VSCodeSourceCodeAccess 3 | ====================== 4 | [https://github.com/christopherreed/VSCodeSourceCodeAccess](https://github.com/christopherreed/VSCodeSourceCodeAccess) 5 | 6 | Unreal Engine 4 plugin that provides source code access for working with C++ projects using [VSCode](https://code.visualstudio.com/). 7 | 8 | You may want to check out [ue4-cpptools](https://github.com/christopherreed/ue4-cpptools), a VSCode extension that provides tools for working with Unreal Engine 4 C++ projects in VSCode. 9 | 10 | Warning 11 | ------- 12 | __USE AT YOUR OWN RISK__ 13 | 14 | This is an **unofficial** plugin and it is not affiliated in any way with Epic Games. This plugin shouldn't be used in a production environment. 15 | 16 | Unreal Engine 4.18 17 | ------------------ 18 | Unreal Engine 4.18 ships with official VSCode support. 19 | 20 | **Future development of this plugin will halt and become maintenance and bug fixes only.** 21 | 22 | The github repo will remain avaialble for use with pre 4.18 versions of Unreal Engine. 23 | 24 | Features 25 | -------- 26 | 27 | This is a very basic plugin that really only provides the ability to open C++ classes and projects in VSCode from the UE4Editor. 28 | 29 | This plugin should work with Unreal Engine versions 4.16 and 4.17 on Linux, Windows, and Mac (not tested). 30 | 31 | Unreal Engine | 4.17 | 4.16 | 4.15 (or older) 32 | ----------------|-------|-------|---------------- 33 | Windows | ok | ok | no 34 | Linux | ok | ok | no 35 | Mac | ? | ? | no 36 | 37 | Install 38 | ------- 39 | 40 | 1) Download the [plugin source](https://github.com/christopherreed/VSCodeSourceCodeAccess) 41 | 42 | 2) Copy the plugin source folder into an existing Unreal Engine 4 C++ project's __Plugins__ folder (*.../MyProject/Plugins/VSCodeSourceCodeAccess*) 43 | 44 | 3) Open the project from Unreal Engine 4 45 | 46 | 4) Select __No__ if prompted to disable the __VSCodeSourceCodeAccess__ plugin because it is incompatible with your engine version 47 | 48 | 5) Select __Yes__ when asked if you would like to build the __VSCodeSourceCodeAccess__ plugin 49 | 50 | > After building the plugin you can make it available to other projects by copying the __VSCodeSourceCodeAccess__ plugin folder to your Unreal Engine 4 __Engine/Plugins__ folder (*...Engine/Plugins/VSCodeSourceCodeAccess*) 51 | 52 | 4) Select __VSCode__ from __Editor Preferences/General - Source Code/Source Code Editor__ 53 | 54 | Usage 55 | ----- 56 | 57 | 58 | Use __File/Open an IDE to edit source code__ or select a C++ Class from UE4Editor and double click or choose __Common/edit...__ from right click menu to open VSCode. 59 | 60 | Settings 61 | -------- 62 | 63 | __Project Settings/Plugins - VSCode/VSCode Path__ : Path to the VSCode executable 64 | 65 | Known Issues 66 | ------------ 67 | 68 | [https://github.com/christopherreed/VSCodeSourceCodeAccess/issues](https://github.com/christopherreed/VSCodeSourceCodeAccess/issues) 69 | 70 | * Mac not tested 71 | 72 | LICENSE 73 | ------- 74 | This software is licensed under the MIT License, see LICENSE for more information 75 | 76 | Buy Me a Coffee at ko-fi.com 77 | -------------------------------------------------------------------------------- /Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/christopherreed/VSCodeSourceCodeAccess/2eda962551a258695a362e9e2ce533900e9fe948/Resources/Icon128.png -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSettings.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #include "VSCodeSettings.h" 23 | 24 | #include "Misc/Paths.h" 25 | #include "Runtime/CoreUObject/Public/UObject/UnrealType.h" 26 | 27 | 28 | #if WITH_EDITOR 29 | 30 | void UVSCodeSettings::PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent) 31 | { 32 | CheckSettings(); 33 | } 34 | 35 | void UVSCodeSettings::PreEditChange(UProperty *Property) 36 | { 37 | Super::PreEditChange(Property); 38 | } 39 | 40 | bool UVSCodeSettings::CheckSettings() 41 | { 42 | if (VSCodePath.IsEmpty() || !FPaths::FileExists(VSCodePath)) 43 | { 44 | #if PLATFORM_WINDOWS 45 | // Prefer 64-bit version of code if present 46 | FString x64 = TEXT("C:\\Program Files\\Microsoft VS Code\\Code.exe"); 47 | if (FPaths::FileExists(x64)) 48 | { 49 | VSCodePath = x64; 50 | } 51 | else 52 | { 53 | VSCodePath = TEXT("C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe"); 54 | } 55 | #elif PLATFORM_MAC 56 | VSCodePath = TEXT("/usr/bin/code"); // Untested 57 | #elif PLATFORM_LINUX 58 | VSCodePath = TEXT("/usr/bin/code"); 59 | #endif 60 | } 61 | 62 | return true; 63 | } 64 | 65 | #endif // WITH_EDITOR -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSettings.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #pragma once 23 | 24 | #include "VSCodeSettings.generated.h" 25 | 26 | UCLASS(config = EditorUserSettings, defaultconfig) 27 | class UVSCodeSettings : public UObject { 28 | GENERATED_BODY() 29 | 30 | public: 31 | 32 | UPROPERTY(Config, EditAnywhere, Category="VSCodeSettings") 33 | FString VSCodePath; 34 | 35 | bool CheckSettings(); 36 | 37 | protected: 38 | 39 | #if WITH_EDITOR 40 | 41 | virtual void PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent) override; 42 | 43 | virtual void PreEditChange(UProperty *Property) override; 44 | 45 | #endif // WITH_EDITOR 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSourceCodeAccessModule.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #include "VSCodeSourceCodeAccessModule.h" 23 | #include "VSCodeSettings.h" 24 | 25 | #include "Runtime/Core/Public/Features/IModularFeatures.h" 26 | #include "Modules/ModuleManager.h" 27 | 28 | #include "Developer/Settings/Public/ISettingsModule.h" 29 | 30 | #define LOCTEXT_NAMESPACE "VSCodeSourceCodeAccessor" 31 | 32 | IMPLEMENT_MODULE( FVSCodeSourceCodeAccessModule, VSCodeSourceCodeAccess ); 33 | 34 | void FVSCodeSourceCodeAccessModule::StartupModule() 35 | { 36 | // Settings 37 | if (ISettingsModule *SettingsModule = FModuleManager::GetModulePtr("Settings")) 38 | { 39 | SettingsModule->RegisterSettings( 40 | "Project", 41 | "Plugins", 42 | "VSCodeSettings", 43 | LOCTEXT("RuntimeSettingsName", "VSCode"), 44 | LOCTEXT("RuntimeSettingsDescription", "Configure the VSCode plugin"), 45 | GetMutableDefault() 46 | ); 47 | } 48 | 49 | VSCodeSourceCodeAccessor.Startup(); 50 | 51 | // Bind our source control provider to the editor 52 | IModularFeatures::Get().RegisterModularFeature(TEXT("SourceCodeAccessor"), &VSCodeSourceCodeAccessor ); 53 | } 54 | 55 | void FVSCodeSourceCodeAccessModule::ShutdownModule() 56 | { 57 | VSCodeSourceCodeAccessor.Shutdown(); 58 | 59 | // Settings 60 | if (ISettingsModule *SettingsModule = FModuleManager::GetModulePtr("Settings")) 61 | { 62 | SettingsModule->UnregisterSettings("Project", "VSCodeSettings", "General"); 63 | } 64 | 65 | // unbind provider from editor 66 | IModularFeatures::Get().UnregisterModularFeature(TEXT("SourceCodeAccessor"), &VSCodeSourceCodeAccessor); 67 | } -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSourceCodeAccessModule.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #pragma once 23 | 24 | #include "CoreMinimal.h" 25 | #include "Modules/ModuleInterface.h" 26 | #include "VSCodeSourceCodeAccessor.h" 27 | 28 | class FVSCodeSourceCodeAccessModule : public IModuleInterface 29 | { 30 | public: 31 | /** IModuleInterface implementation */ 32 | virtual void StartupModule() override; 33 | virtual void ShutdownModule() override; 34 | 35 | private: 36 | FVSCodeSourceCodeAccessor VSCodeSourceCodeAccessor; 37 | }; -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSourceCodeAccessor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #include "VSCodeSourceCodeAccessor.h" 23 | #include "CoreMinimal.h" 24 | #include "DesktopPlatformModule.h" 25 | #include "Modules/ModuleManager.h" 26 | #include "VSCodeSourceCodeAccessModule.h" 27 | #include "ISourceCodeAccessModule.h" 28 | #include "Misc/Paths.h" 29 | 30 | #define LOCTEXT_NAMESPACE "VSCodeSourceCodeAccessor" 31 | 32 | DEFINE_LOG_CATEGORY_STATIC(LogVSCodeAccessor, Log, All); 33 | 34 | void FVSCodeSourceCodeAccessor::Startup() 35 | { 36 | Settings = GetMutableDefault (); 37 | Settings->CheckSettings(); 38 | 39 | FString ProjectFile = *FPaths::ConvertRelativePathToFull(*FPaths::GetProjectFilePath()); 40 | FPaths::NormalizeFilename(ProjectFile); 41 | 42 | ProjectDir = *FPaths::ConvertRelativePathToFull(*FPaths::GetPath(ProjectFile)); 43 | FPaths::NormalizeFilename(ProjectDir); 44 | 45 | // Sanity check 46 | if (!FPaths::DirectoryExists(ProjectDir)) 47 | { 48 | UE_LOG(LogVSCodeAccessor, Error, TEXT("Failed to access project directory '%s'"), *ProjectDir); 49 | } 50 | 51 | } 52 | 53 | void FVSCodeSourceCodeAccessor::Shutdown() 54 | { 55 | Settings = nullptr; 56 | } 57 | 58 | bool FVSCodeSourceCodeAccessor::CanAccessSourceCode() const 59 | { 60 | return Settings->CheckSettings(); 61 | } 62 | 63 | FName FVSCodeSourceCodeAccessor::GetFName() const 64 | { 65 | return FName("VSCodeSourceCodeAccessor"); 66 | } 67 | 68 | FText FVSCodeSourceCodeAccessor::GetNameText() const 69 | { 70 | return LOCTEXT("VSCodeDisplayName", "VSCode"); 71 | } 72 | 73 | FText FVSCodeSourceCodeAccessor::GetDescriptionText() const 74 | { 75 | return LOCTEXT("VSCodeDisplayDesc", "Open source code files in Visual Studio Code"); 76 | } 77 | 78 | bool FVSCodeSourceCodeAccessor::OpenSolution() 79 | { 80 | // A project in VSCode is simply a directory, optionally with a .vscode sub directory to configure extensions 81 | // Open project directory in VSCode 82 | // Add this to handle spaces in path names 83 | const FString FixedProjectDir = FString::Printf(TEXT("\"%s\""), *ProjectDir); 84 | 85 | FProcHandle Proc = FPlatformProcess::CreateProc(*Settings->VSCodePath, *FixedProjectDir, true, true, false, nullptr, 0, nullptr, nullptr); 86 | 87 | if (!Proc.IsValid()) 88 | { 89 | FPlatformProcess::CloseProc(Proc); 90 | return false; 91 | } 92 | 93 | return true; 94 | } 95 | 96 | bool FVSCodeSourceCodeAccessor::OpenFileAtLine(const FString& FullPath, int32 LineNumber, int32 ColumnNumber) 97 | { 98 | // Column & line numbers are 1-based, so dont allow zero 99 | LineNumber = LineNumber > 0 ? LineNumber : 1; 100 | ColumnNumber = ColumnNumber > 0 ? ColumnNumber : 1; 101 | 102 | // Open Project directory and file in VSCode 103 | // Add this to handle spaces in path names 104 | const FString FixedFilePath = FString::Printf(TEXT("\"%s\" -g \"%s:%d:%d\""), *ProjectDir, *FullPath, LineNumber, ColumnNumber); 105 | 106 | FProcHandle Proc = FPlatformProcess::CreateProc(*Settings->VSCodePath, *FixedFilePath, true, false, false, nullptr, 0, nullptr, nullptr); 107 | if (!Proc.IsValid()) 108 | { 109 | FPlatformProcess::CloseProc(Proc); 110 | return false; 111 | } 112 | 113 | return true; 114 | } 115 | 116 | bool FVSCodeSourceCodeAccessor::OpenSourceFiles(const TArray& AbsoluteSourcePaths) 117 | { 118 | // Open project directory and files in VSCode 119 | // VSCode will open them all in the same instance 120 | for (const FString& SourcePath : AbsoluteSourcePaths) 121 | { 122 | // Add this to handle spaces in path names 123 | const FString FixedFilePath = FString::Printf(TEXT("\"%s\" \"%s\""), *ProjectDir, *SourcePath); 124 | 125 | FProcHandle Proc = FPlatformProcess::CreateProc(*Settings->VSCodePath, *FixedFilePath, true, false, false, nullptr, 0, nullptr, nullptr); 126 | if (!Proc.IsValid()) 127 | { 128 | FPlatformProcess::CloseProc(Proc); 129 | return false; 130 | } 131 | } 132 | 133 | return true; 134 | } 135 | 136 | bool FVSCodeSourceCodeAccessor::AddSourceFiles(const TArray& AbsoluteSourcePaths, const TArray& AvailableModules) 137 | { 138 | return true; // I don't think we need to do anything when files are added 139 | } 140 | 141 | bool FVSCodeSourceCodeAccessor::SaveAllOpenDocuments() const 142 | { 143 | return false; 144 | } 145 | 146 | void FVSCodeSourceCodeAccessor::Tick(const float DeltaTime) 147 | { 148 | } 149 | 150 | #undef LOCTEXT_NAMESPACE -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/Private/VSCodeSourceCodeAccessor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Christopher Reed 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 21 | 22 | #pragma once 23 | 24 | #include "CoreMinimal.h" 25 | #include "ISourceCodeAccessor.h" 26 | 27 | class FVSCodeSourceCodeAccessor : public ISourceCodeAccessor 28 | { 29 | public: 30 | /** ISourceCodeAccessor implementation */ 31 | virtual void RefreshAvailability() override { } 32 | virtual bool CanAccessSourceCode() const override; 33 | virtual FName GetFName() const override; 34 | virtual FText GetNameText() const override; 35 | virtual FText GetDescriptionText() const override; 36 | virtual bool OpenSolution() override; 37 | virtual bool OpenFileAtLine(const FString& FullPath, int32 LineNumber, int32 ColumnNumber = 0) override; 38 | virtual bool OpenSourceFiles(const TArray& AbsoluteSourcePaths) override; 39 | virtual bool AddSourceFiles(const TArray& AbsoluteSourcePaths, const TArray& AvailableModules) override; 40 | virtual bool SaveAllOpenDocuments() const override; 41 | virtual void Tick(const float DeltaTime) override; 42 | 43 | void Startup(); 44 | void Shutdown(); 45 | private: 46 | // Project directory 47 | FString ProjectDir; 48 | 49 | class UVSCodeSettings *Settings = nullptr; 50 | }; -------------------------------------------------------------------------------- /Source/VSCodeSourceCodeAccess/VSCodeSourceCodeAccess.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. 2 | 3 | namespace UnrealBuildTool.Rules 4 | { 5 | public class VSCodeSourceCodeAccess : ModuleRules 6 | { 7 | public VSCodeSourceCodeAccess(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | // https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/IWYUReferenceGuide/index.html 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | 12 | PrivateDependencyModuleNames.AddRange( 13 | new string[] 14 | { 15 | "Core", 16 | "CoreUObject", 17 | "SourceCodeAccess", 18 | "DesktopPlatform", 19 | "Settings" 20 | } 21 | ); 22 | 23 | if (UEBuildConfiguration.bBuildEditor) 24 | { 25 | PrivateDependencyModuleNames.Add("HotReload"); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /VSCodeSourceCodeAccess.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion" : 3, 3 | "Version" : 1, 4 | "VersionName" : "1.0", 5 | "FriendlyName" : "VSCode Plugin", 6 | "Description" : "Provides source code access for working with C++ projects using VSCode", 7 | "Category" : "Programming", 8 | "CreatedBy" : "Christopher Reed", 9 | "CreatedByURL" : "https://github.com/christopherreed/VSCodeSourceCodeAccess", 10 | "DocsURL" : "", 11 | "MarketplaceURL" : "", 12 | "SupportURL" : "https://github.com/christopherreed/VSCodeSourceCodeAccess/issues", 13 | "EnabledByDefault" : true, 14 | "CanContainContent" : false, 15 | "IsBetaVersion" : false, 16 | "Installed" : false, 17 | "Modules" : 18 | [ 19 | { 20 | "Name" : "VSCodeSourceCodeAccess", 21 | "Type" : "Developer", 22 | "LoadingPhase" : "Default", 23 | "WhitelistPlatforms" : 24 | [ 25 | "Linux", 26 | "Win64", 27 | "Win32", 28 | "Mac" 29 | ] 30 | } 31 | ] 32 | } --------------------------------------------------------------------------------