Skip to content

Commit

Permalink
provide constructor accepting hostServices (OmniSharp#2373)
Browse files Browse the repository at this point in the history
* provide constructor accepting hostServices

aggregator.CreateHostServices is a time-consuming job, which can be handled outside of the omnisharp.

* Update OmniSharpWorkspace.cs

* Remove  ImportingConstructor for the overloaded constructor

Co-authored-by: Filip W <[email protected]>
  • Loading branch information
stg609 and filipw authored Apr 7, 2022
1 parent faff2cf commit 9a09299
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/OmniSharp.Roslyn/OmniSharpWorkspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
using Microsoft.Extensions.Logging;
using OmniSharp.FileSystem;
Expand Down Expand Up @@ -50,7 +51,12 @@ public bool Initialized

[ImportingConstructor]
public OmniSharpWorkspace(HostServicesAggregator aggregator, ILoggerFactory loggerFactory, IFileSystemWatcher fileSystemWatcher)
: base(aggregator.CreateHostServices(), "Custom")
: this(aggregator.CreateHostServices(), loggerFactory, fileSystemWatcher)
{
}

public OmniSharpWorkspace(HostServices hostServices, ILoggerFactory loggerFactory, IFileSystemWatcher fileSystemWatcher)
: base(hostServices, "Custom")
{
BufferManager = new BufferManager(this, loggerFactory, fileSystemWatcher);
_logger = loggerFactory.CreateLogger<OmniSharpWorkspace>();
Expand Down

0 comments on commit 9a09299

Please sign in to comment.