Skip to content

Commit

Permalink
fix detecting Godot project on the first solution opening #114
Browse files Browse the repository at this point in the history
  • Loading branch information
van800 committed Oct 18, 2023
1 parent 29cdb8b commit b97a874
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
27 changes: 16 additions & 11 deletions resharper/src/ProjectModel/GodotTracker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using JetBrains.ProjectModel;
using JetBrains.ProjectModel.Tasks;
using JetBrains.Rd.Base;
using JetBrains.ReSharper.Feature.Services.Protocol;
using JetBrains.Rider.Model.Godot.FrontendBackend;
Expand All @@ -11,19 +12,23 @@ namespace JetBrains.ReSharper.Plugins.Godot.ProjectModel
public class GodotTracker
{
public VirtualFileSystemPath MainProjectBasePath { get; private set; }
public GodotTracker(ISolution solution, ILogger logger)
public GodotTracker(ISolution solution, ILogger logger, ISolutionLoadTasksScheduler tasksScheduler)
{
var model = solution.GetProtocolSolution().GetGodotFrontendBackendModel();

foreach (var project in solution.GetTopLevelProjects().Where(project => project.IsGodotProject()))
{
var file = project.Location.Combine("project.godot");
if (!file.ExistsFile) continue;
MainProjectBasePath = file.Directory;
logger.Verbose($"Godot MainProjectBasePath: {file.Directory}");
model.MainProjectBasePath.SetValue(MainProjectBasePath.FullPath);
break;
}
tasksScheduler.EnqueueTask(new SolutionLoadTask("UnityTechnologyDescriptionCollector",
SolutionLoadTaskKinds.Done,
() =>
{
foreach (var project in solution.GetTopLevelProjects().Where(project => project.IsGodotProject()))
{
var file = project.Location.Combine("project.godot");
if (!file.ExistsFile) continue;
MainProjectBasePath = file.Directory;
logger.Verbose($"Godot MainProjectBasePath: {file.Directory}");
model.MainProjectBasePath.SetValue(file.Directory.FullPath);
break;
}
}));
}
}
}
7 changes: 2 additions & 5 deletions resharper/src/ZoneMarker.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.DocumentModel;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.Rider.Backend.Env;
using JetBrains.Rider.Backend.Product;
using JetBrains.Rider.Model;

namespace JetBrains.ReSharper.Plugins.Godot
{
[ZoneMarker]
public class ZoneMarker : IRequire<IRiderProductEnvironmentZone>, IRequire<IProjectModelZone>, IRequire<IRiderModelZone>, IRequire<IDocumentModelZone>, IRequire<PsiFeaturesImplZone>
public class ZoneMarker : IRequire<IRiderProductEnvironmentZone>, IRequire<IRiderFeatureZone>
{
}
}

0 comments on commit b97a874

Please sign in to comment.