// Copyright (c) Wojciech Figat. All rights reserved. using System; namespace FlaxEditor.Modules.SourceCodeEditing { /// /// In-build source code editor. /// /// internal class InBuildSourceCodeEditor : ISourceCodeEditor { /// /// The type of the editor. /// public readonly CodeEditorTypes Type; /// /// Initializes a new instance of the class. /// /// The type. public InBuildSourceCodeEditor(CodeEditorTypes type) { Type = type; Name = CodeEditingManager.GetName(type); } /// public string Name { get; set; } /// public string GenerateProjectCustomArgs { get { switch (Type) { case CodeEditorTypes.VSCodeInsiders: case CodeEditorTypes.VSCode: return "-vscode -vs2022"; case CodeEditorTypes.Rider: return "-vs2022"; default: return null; } } } /// public void OpenSolution() { CodeEditingManager.OpenSolution(Type); } /// public void OpenFile(string path, int line) { CodeEditingManager.OpenFile(Type, path, line); } /// public void OnFileAdded(string path) { switch (Type) { case CodeEditorTypes.VS2008: case CodeEditorTypes.VS2010: case CodeEditorTypes.VS2012: case CodeEditorTypes.VS2013: case CodeEditorTypes.VS2015: case CodeEditorTypes.VS2017: case CodeEditorTypes.VS2019: case CodeEditorTypes.VS2022: case CodeEditorTypes.VS2026: // TODO: finish dynamic files adding to the project //Editor.Instance.ProgressReporting.GenerateScriptsProjectFiles.RunAsync(); break; default: CodeEditingManager.OnFileAdded(Type, path); break; } } /// public void OnSelected(Editor editor) { } /// public void OnDeselected(Editor editor) { } /// public void OnAdded(Editor editor) { } /// public void OnRemoved(Editor editor) { } } }