Skip to content

Commit

Permalink
delay project system init to avoid solution update race
Browse files Browse the repository at this point in the history
  • Loading branch information
corngood committed Dec 31, 2020
1 parent 8f3b6ea commit efff66a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/OmniSharp.Host/WorkspaceInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ public static void Initialize(IServiceProvider serviceProvider, CompositionHost

var projectEventForwarder = compositionHost.GetExport<ProjectEventForwarder>();
projectEventForwarder.Initialize();
var projectSystems = compositionHost.GetExports<IProjectSystem>();

workspace.EditorConfigEnabled = options.CurrentValue.FormattingOptions.EnableEditorConfigSupport;
options.OnChange(x => workspace.EditorConfigEnabled = x.FormattingOptions.EnableEditorConfigSupport);

logger.LogDebug("Starting with OmniSharp options: {options}", options.CurrentValue);
ProvideWorkspaceOptions(compositionHost, workspace, options, logger, omnisharpEnvironment);

// when configuration options change
// run workspace options providers automatically
options.OnChange(o =>
{
logger.LogDebug("OmniSharp options changed: {options}", options.CurrentValue);
ProvideWorkspaceOptions(compositionHost, workspace, options, logger, omnisharpEnvironment);
});

var projectSystems = compositionHost.GetExports<IProjectSystem>();
foreach (var projectSystem in projectSystems)
{
try
Expand All @@ -55,20 +66,9 @@ public static void Initialize(IServiceProvider serviceProvider, CompositionHost
}
}

logger.LogDebug("Starting with OmniSharp options: {options}", options.CurrentValue);
ProvideWorkspaceOptions(compositionHost, workspace, options, logger, omnisharpEnvironment);

// Mark the workspace as initialized
workspace.Initialized = true;

// when configuration options change
// run workspace options providers automatically
options.OnChange(o =>
{
logger.LogDebug("OmniSharp options changed: {options}", options.CurrentValue);
ProvideWorkspaceOptions(compositionHost, workspace, options, logger, omnisharpEnvironment);
});

logger.LogInformation("Configuration finished.");
}

Expand Down

0 comments on commit efff66a

Please sign in to comment.