Merge remote-tracking branch 'origin/master' into 1.12
# Conflicts: # Content/Shaders/GI/DDGI.flax # Content/Shaders/GUI.flax # Flax.flaxproj # Source/Editor/Windows/AboutDialog.cs # Source/Engine/Serialization/Stream.cpp # Source/Shaders/GUICommon.hlsl
This commit is contained in:
@@ -139,6 +139,34 @@ CodeEditor* CodeEditingManager::GetCodeEditor(CodeEditorTypes editorType)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
String CodeEditingManager::GetName(CodeEditorTypes editorType)
|
||||
{
|
||||
const auto editor = GetCodeEditor(editorType);
|
||||
if (editor)
|
||||
{
|
||||
return editor->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Warning, "Missing code editor type {0}", (int32)editorType);
|
||||
return String::Empty;
|
||||
}
|
||||
}
|
||||
|
||||
String CodeEditingManager::GetGenerateProjectCustomArgs(CodeEditorTypes editorType)
|
||||
{
|
||||
const auto editor = GetCodeEditor(editorType);
|
||||
if (editor)
|
||||
{
|
||||
return editor->GetGenerateProjectCustomArgs();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Warning, "Missing code editor type {0}", (int32)editorType);
|
||||
return String::Empty;
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditingManager::OpenFile(CodeEditorTypes editorType, const String& path, int32 line)
|
||||
{
|
||||
const auto editor = GetCodeEditor(editorType);
|
||||
|
||||
@@ -109,9 +109,18 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the name of the editor.
|
||||
/// </summary>
|
||||
/// <returns>The name</returns>
|
||||
/// <returns>The name.</returns>
|
||||
virtual String GetName() const = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the custom arguments for the Flax.Build tool to add when generating project files for this code editor.
|
||||
/// </summary>
|
||||
/// <returns>The custom arguments to generate project files.</returns>
|
||||
virtual String GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return String::Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the file.
|
||||
/// </summary>
|
||||
@@ -169,6 +178,20 @@ public:
|
||||
/// <returns>The editor object or null if not found.</returns>
|
||||
static CodeEditor* GetCodeEditor(CodeEditorTypes editorType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the editor.
|
||||
/// </summary>
|
||||
/// <param name="editorType">The code editor type.</param>
|
||||
/// <returns>The name.</returns>
|
||||
API_FUNCTION() static String GetName(CodeEditorTypes editorType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the custom arguments for the Flax.Build tool to add when generating project files for this code editor.
|
||||
/// </summary>
|
||||
/// <param name="editorType">The code editor type.</param>
|
||||
/// <returns>The custom arguments to generate project files.</returns>
|
||||
API_FUNCTION() static String GetGenerateProjectCustomArgs(CodeEditorTypes editorType);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the file. Handles async opening.
|
||||
/// </summary>
|
||||
|
||||
@@ -257,12 +257,17 @@ String RiderCodeEditor::GetName() const
|
||||
return TEXT("Rider");
|
||||
}
|
||||
|
||||
String RiderCodeEditor::GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return TEXT("-vs2022");
|
||||
}
|
||||
|
||||
void RiderCodeEditor::OpenFile(const String& path, int32 line)
|
||||
{
|
||||
// Generate project files if solution is missing
|
||||
if (!FileSystem::FileExists(_solutionPath))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2022"));
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
}
|
||||
|
||||
// Open file
|
||||
@@ -290,7 +295,7 @@ void RiderCodeEditor::OpenSolution()
|
||||
// Generate project files if solution is missing
|
||||
if (!FileSystem::FileExists(_solutionPath))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject(TEXT("-vs2022"));
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
}
|
||||
|
||||
// Open solution
|
||||
@@ -312,5 +317,5 @@ void RiderCodeEditor::OpenSolution()
|
||||
|
||||
void RiderCodeEditor::OnFileAdded(const String& path)
|
||||
{
|
||||
ScriptsBuilder::GenerateProject();
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
// [CodeEditor]
|
||||
CodeEditorTypes GetType() const override;
|
||||
String GetName() const override;
|
||||
String GetGenerateProjectCustomArgs() const override;
|
||||
void OpenFile(const String& path, int32 line) override;
|
||||
void OpenSolution() override;
|
||||
void OnFileAdded(const String& path) override;
|
||||
|
||||
@@ -145,7 +145,46 @@ CodeEditorTypes VisualStudioEditor::GetType() const
|
||||
|
||||
String VisualStudioEditor::GetName() const
|
||||
{
|
||||
return String(ToString(_version));
|
||||
const Char* name;
|
||||
switch (_version)
|
||||
{
|
||||
case VisualStudioVersion::VS2008:
|
||||
name = TEXT("Visual Studio 2008");
|
||||
break;
|
||||
case VisualStudioVersion::VS2010:
|
||||
name = TEXT("Visual Studio 2010");
|
||||
break;
|
||||
case VisualStudioVersion::VS2012:
|
||||
name = TEXT("Visual Studio 2012");
|
||||
break;
|
||||
case VisualStudioVersion::VS2013:
|
||||
name = TEXT("Visual Studio 2013");
|
||||
break;
|
||||
case VisualStudioVersion::VS2015:
|
||||
name = TEXT("Visual Studio 2015");
|
||||
break;
|
||||
case VisualStudioVersion::VS2017:
|
||||
name = TEXT("Visual Studio 2017");
|
||||
break;
|
||||
case VisualStudioVersion::VS2019:
|
||||
name = TEXT("Visual Studio 2019");
|
||||
break;
|
||||
case VisualStudioVersion::VS2022:
|
||||
name = TEXT("Visual Studio 2022");
|
||||
break;
|
||||
case VisualStudioVersion::VS2026:
|
||||
name = TEXT("Visual Studio 2026");
|
||||
break;
|
||||
default:
|
||||
name = ToString(_version);
|
||||
break;
|
||||
}
|
||||
return String(name);
|
||||
}
|
||||
|
||||
String VisualStudioEditor::GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return String::Format(TEXT("-{0}"), String(ToString(_version)).ToLower());
|
||||
}
|
||||
|
||||
void VisualStudioEditor::OpenFile(const String& path, int32 line)
|
||||
@@ -153,7 +192,7 @@ void VisualStudioEditor::OpenFile(const String& path, int32 line)
|
||||
// Generate project files if solution is missing
|
||||
if (!FileSystem::FileExists(_solutionPath))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject();
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
}
|
||||
|
||||
// Open file
|
||||
@@ -172,7 +211,7 @@ void VisualStudioEditor::OpenSolution()
|
||||
// Generate project files if solution is missing
|
||||
if (!FileSystem::FileExists(_solutionPath))
|
||||
{
|
||||
ScriptsBuilder::GenerateProject();
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
}
|
||||
|
||||
// Open solution
|
||||
@@ -187,7 +226,7 @@ void VisualStudioEditor::OpenSolution()
|
||||
void VisualStudioEditor::OnFileAdded(const String& path)
|
||||
{
|
||||
// TODO: finish dynamic files adding to the project - for now just regenerate it
|
||||
ScriptsBuilder::GenerateProject();
|
||||
ScriptsBuilder::GenerateProject(GetGenerateProjectCustomArgs());
|
||||
return;
|
||||
if (!FileSystem::FileExists(_solutionPath))
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
// [CodeEditor]
|
||||
CodeEditorTypes GetType() const override;
|
||||
String GetName() const override;
|
||||
String GetGenerateProjectCustomArgs() const override;
|
||||
void OpenFile(const String& path, int32 line) override;
|
||||
void OpenSolution() override;
|
||||
void OnFileAdded(const String& path) override;
|
||||
|
||||
@@ -128,6 +128,11 @@ String VisualStudioCodeEditor::GetName() const
|
||||
return _isInsiders ? TEXT("Visual Studio Code - Insiders") : TEXT("Visual Studio Code");
|
||||
}
|
||||
|
||||
String VisualStudioCodeEditor::GetGenerateProjectCustomArgs() const
|
||||
{
|
||||
return TEXT("-vs2022 -vscode");
|
||||
}
|
||||
|
||||
void VisualStudioCodeEditor::OpenFile(const String& path, int32 line)
|
||||
{
|
||||
// Generate VS solution files for intellisense
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
// [CodeEditor]
|
||||
CodeEditorTypes GetType() const override;
|
||||
String GetName() const override;
|
||||
String GetGenerateProjectCustomArgs() const override;
|
||||
void OpenFile(const String& path, int32 line) override;
|
||||
void OpenSolution() override;
|
||||
bool UseAsyncForOpen() const override;
|
||||
|
||||
Reference in New Issue
Block a user