Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Rider as external editor for Godot mono version #34181

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/mono/build_scripts/godot_tools_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def build(env_mono, api_sln_cmd):

target_filenames = [
'GodotTools.dll', 'GodotTools.IdeConnection.dll', 'GodotTools.BuildLogger.dll',
'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll'
'GodotTools.ProjectEditor.dll', 'DotNet.Glob.dll', 'GodotTools.Core.dll',
'JetBrains.Annotations.dll', 'Newtonsoft.Json.dll'
]

if env_mono['target'] == 'debug':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum ExternalEditorId
VisualStudio, // TODO (Windows-only)
VisualStudioForMac, // Mac-only
MonoDevelop,
VsCode
VsCode,
Rider
}
}
20 changes: 17 additions & 3 deletions modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using GodotTools.Ides;
using GodotTools.Ides.Rider;
using GodotTools.Internals;
using GodotTools.ProjectEditor;
using JetBrains.Annotations;
using static GodotTools.Internals.Globals;
using File = GodotTools.Utils.File;
using OS = GodotTools.Utils.OS;
Expand Down Expand Up @@ -189,6 +191,7 @@ public void ShowErrorDialog(string message, string title = "Error")
"code", "code-oss", "vscode", "vscode-oss", "visual-studio-code", "visual-studio-code-oss"
};

[UsedImplicitly]
public Error OpenInExternalEditor(Script script, int line, int col)
{
var editor = (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor");
Expand All @@ -202,6 +205,12 @@ public Error OpenInExternalEditor(Script script, int line, int col)
throw new NotSupportedException();
case ExternalEditorId.VisualStudioForMac:
goto case ExternalEditorId.MonoDevelop;
case ExternalEditorId.Rider:
{
string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
RiderPathManager.OpenFile(GodotSharpDirs.ProjectSlnPath, scriptPath, line);
return Error.Ok;
}
case ExternalEditorId.MonoDevelop:
{
string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
Expand Down Expand Up @@ -306,6 +315,7 @@ public Error OpenInExternalEditor(Script script, int line, int col)
return Error.Ok;
}

[UsedImplicitly]
public bool OverridesExternalEditor()
{
return (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
Expand Down Expand Up @@ -419,18 +429,21 @@ public override void EnablePlugin()
if (OS.IsWindows)
{
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
}
else if (OS.IsOSX)
{
settingsHintStr += $",Visual Studio:{(int) ExternalEditorId.VisualStudioForMac}" +
$",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
}
else if (OS.IsUnixLike())
{
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}";
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
}

editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
Expand All @@ -448,6 +461,7 @@ public override void EnablePlugin()
exportPluginWeak = WeakRef(exportPlugin);

BuildManager.Initialize();
RiderPathManager.Initialize();

GodotIdeManager = new GodotIdeManager();
AddChild(GodotIdeManager);
Expand Down
17 changes: 17 additions & 0 deletions modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="JetBrains.Annotations, Version=2019.1.3.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325">
<HintPath>..\packages\JetBrains.Annotations.2019.1.3\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Posix" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
neikeq marked this conversation as resolved.
Show resolved Hide resolved
<Reference Include="System" />
<Reference Include="GodotSharp">
<HintPath>$(GodotSourceRootPath)/bin/GodotSharp/Api/$(GodotApiConfiguration)/GodotSharp.dll</HintPath>
Expand All @@ -47,6 +55,8 @@
<Compile Include="Ides\GodotIdeServer.cs" />
<Compile Include="Ides\MonoDevelop\EditorId.cs" />
<Compile Include="Ides\MonoDevelop\Instance.cs" />
<Compile Include="Ides\Rider\RiderPathLocator.cs" />
<Compile Include="Ides\Rider\RiderPathManager.cs" />
<Compile Include="Internals\BindingsGenerator.cs" />
<Compile Include="Internals\EditorProgress.cs" />
<Compile Include="Internals\GodotSharpDirs.cs" />
Expand All @@ -67,6 +77,7 @@
<Compile Include="BottomPanel.cs" />
<Compile Include="CsProjOperations.cs" />
<Compile Include="Utils\CollectionExtensions.cs" />
<Compile Include="Utils\User32Dll.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GodotTools.BuildLogger\GodotTools.BuildLogger.csproj">
Expand All @@ -86,5 +97,11 @@
<Name>GodotTools.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Ides\Rider\.editorconfig" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private void LaunchIde()
case ExternalEditorId.None:
case ExternalEditorId.VisualStudio:
case ExternalEditorId.VsCode:
case ExternalEditorId.Rider:
throw new NotSupportedException();
case ExternalEditorId.VisualStudioForMac:
goto case ExternalEditorId.MonoDevelop;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why default to 2-space indentation? Also, this file doesn't end with a newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this PR was already merged, I suggest we just talk on discord
van800#9412.
Would it be ok?

Loading