mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 21:01:48 +00:00
Show popup when opening script and no IDE is configured
This commit is contained in:
@@ -9,6 +9,7 @@ using GlitchyEngine.Renderer;
|
|||||||
using GlitchyEngine;
|
using GlitchyEngine;
|
||||||
using GlitchyEditor.CodeEditors;
|
using GlitchyEditor.CodeEditors;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using GlitchyEditor.Settings;
|
||||||
|
|
||||||
namespace GlitchyEditor.EditWindows;
|
namespace GlitchyEditor.EditWindows;
|
||||||
|
|
||||||
@@ -316,8 +317,7 @@ class LogWindow : EditorWindow
|
|||||||
float width = ImGui.CalcTextSize(lineBuffer.CStr()).x;
|
float width = ImGui.CalcTextSize(lineBuffer.CStr()).x;
|
||||||
if (ImGui.Selectable(lineBuffer, false, .None, .(width, 0)))
|
if (ImGui.Selectable(lineBuffer, false, .None, .(width, 0)))
|
||||||
{
|
{
|
||||||
// TODO: Columns?
|
Editor.Instance.OpenScript(frameInfo.FileName, frameInfo.Line, frameInfo.Column);
|
||||||
Editor.Instance.IdeAdapter.OpenScript(frameInfo.FileName, frameInfo.Line, frameInfo.Column);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,13 +336,13 @@ class LogWindow : EditorWindow
|
|||||||
{
|
{
|
||||||
if (message.Source.MessageOrigin != null)
|
if (message.Source.MessageOrigin != null)
|
||||||
{
|
{
|
||||||
Editor.Instance.IdeAdapter.OpenScript(message.Source.MessageOrigin.FileName, message.Source.MessageOrigin.LineNumber);
|
Editor.Instance.OpenScript(message.Source.MessageOrigin.FileName, message.Source.MessageOrigin.LineNumber);
|
||||||
}
|
}
|
||||||
else if (message.Source.Exception != null)
|
else if (message.Source.Exception != null)
|
||||||
{
|
{
|
||||||
// TODO: Column?
|
// TODO: Column?
|
||||||
let firstFrame = message.Source.Exception.StackTrace.Frames[0];
|
let firstFrame = message.Source.Exception.StackTrace.Frames[0];
|
||||||
Editor.Instance.IdeAdapter.OpenScript(firstFrame.FileName, firstFrame.Line);
|
Editor.Instance.OpenScript(firstFrame.FileName, firstFrame.Line);
|
||||||
//message.Source.Exception.StackTrace
|
//message.Source.Exception.StackTrace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,5 +177,37 @@ namespace GlitchyEditor
|
|||||||
{
|
{
|
||||||
_settingsWindow.Open = true;
|
_settingsWindow.Open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Wrapper for IdeAdapter.OpenScript that check whether or not an IDE Adapter is configured.
|
||||||
|
/// If not, a popup will be show.
|
||||||
|
public void OpenScript(StringView fileName, int lineNumber = 0, int columnNumber = 0)
|
||||||
|
{
|
||||||
|
if (IdeAdapter == null)
|
||||||
|
{
|
||||||
|
PopupService.Instance.OpenPopup("No IDE configured.", new (close) => {
|
||||||
|
close = false;
|
||||||
|
|
||||||
|
ImGui.TextUnformatted("In order to open a source file you need to configure an IDE to use.");
|
||||||
|
|
||||||
|
if (ImGui.Button("Go to settings..."))
|
||||||
|
{
|
||||||
|
ShowSettings();
|
||||||
|
SettingsWindow.HighlightSetting("Tools", "ide");
|
||||||
|
close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
if (ImGui.Button("Cancel"))
|
||||||
|
{
|
||||||
|
close = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IdeAdapter.OpenScript(fileName, lineNumber, columnNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user