Rename existing editor settings mono -> dotnet

This commit is contained in:
Paul Joannon 2023-01-25 11:51:07 +01:00
parent bdad9770d6
commit e51a20b714
No known key found for this signature in database
GPG key ID: C12F69B0AD0390DD
3 changed files with 15 additions and 10 deletions

View file

@ -22,6 +22,11 @@ namespace GodotTools
{
public partial class GodotSharpEditor : EditorPlugin, ISerializationListener
{
public static class Settings
{
public const string ExternalEditor = "dotnet/editor/external_editor";
}
private EditorSettings _editorSettings;
private PopupMenu _menuPopup;
@ -171,7 +176,7 @@ namespace GodotTools
[UsedImplicitly]
public Error OpenInExternalEditor(Script script, int line, int col)
{
var editorId = (ExternalEditorId)(int)_editorSettings.GetSetting("mono/editor/external_editor");
var editorId = _editorSettings.GetSetting(Settings.ExternalEditor).As<ExternalEditorId>();
switch (editorId)
{
@ -323,8 +328,7 @@ namespace GodotTools
[UsedImplicitly]
public bool OverridesExternalEditor()
{
return (ExternalEditorId)(int)_editorSettings.GetSetting("mono/editor/external_editor") !=
ExternalEditorId.None;
return _editorSettings.GetSetting(Settings.ExternalEditor).As<ExternalEditorId>() != ExternalEditorId.None;
}
public override bool _Build()
@ -453,7 +457,7 @@ namespace GodotTools
_menuPopup.IdPressed += _MenuOptionPressed;
// External editor settings
EditorDef("mono/editor/external_editor", Variant.From(ExternalEditorId.None));
EditorDef(Settings.ExternalEditor, Variant.From(ExternalEditorId.None));
string settingsHintStr = "Disabled";
@ -481,7 +485,7 @@ namespace GodotTools
_editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
{
["type"] = (int)Variant.Type.Int,
["name"] = "mono/editor/external_editor",
["name"] = Settings.ExternalEditor,
["hint"] = (int)PropertyHint.Enum,
["hint_string"] = settingsHintStr
});

View file

@ -21,7 +21,8 @@ namespace GodotTools.Ides
return _messagingServer;
_messagingServer?.Dispose();
_messagingServer = new MessagingServer(OS.GetExecutablePath(), ProjectSettings.GlobalizePath(GodotSharpDirs.ResMetadataDir), new GodotLogger());
_messagingServer = new MessagingServer(OS.GetExecutablePath(),
ProjectSettings.GlobalizePath(GodotSharpDirs.ResMetadataDir), new GodotLogger());
_ = _messagingServer.Listen();
@ -76,8 +77,8 @@ namespace GodotTools.Ides
public async Task<EditorPick?> LaunchIdeAsync(int millisecondsTimeout = 10000)
{
var editorId = (ExternalEditorId)(int)GodotSharpEditor.Instance.GetEditorInterface()
.GetEditorSettings().GetSetting("mono/editor/external_editor");
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
var editorId = editorSettings.GetSetting(GodotSharpEditor.Settings.ExternalEditor).As<ExternalEditorId>();
string editorIdentity = GetExternalEditorIdentity(editorId);
var runningServer = GetRunningOrNewServer();

View file

@ -9,7 +9,7 @@ namespace GodotTools.Ides.Rider
{
public static class RiderPathManager
{
public static readonly string EditorPathSettingName = "mono/editor/editor_path_optional";
public static readonly string EditorPathSettingName = "dotnet/editor/editor_path_optional";
private static string GetRiderPathFromSettings()
{
@ -22,7 +22,7 @@ namespace GodotTools.Ides.Rider
public static void Initialize()
{
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
var editor = (ExternalEditorId)(int)editorSettings.GetSetting("mono/editor/external_editor");
var editor = editorSettings.GetSetting(GodotSharpEditor.Settings.ExternalEditor).As<ExternalEditorId>();
if (editor == ExternalEditorId.Rider)
{
if (!editorSettings.HasSetting(EditorPathSettingName))