From ecbd32720505d3b9b8cdefd64682d7c735b4a854 Mon Sep 17 00:00:00 2001 From: filipw Date: Fri, 5 May 2017 13:17:52 +0200 Subject: [PATCH 1/7] added code actions folder support --- .../Options/CodeActionOptions.cs | 9 ++++ .../Options/OmniSharpOptions.cs | 2 + .../Services/IAssemblyLoader.cs | 2 + src/OmniSharp.Host/Services/AssemblyLoader.cs | 43 ++++++++++++++++++- .../RoslynFeaturesHostServicesProvider.cs | 8 +++- src/OmniSharp/app.config | 16 +++++++ 6 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/OmniSharp.Abstractions/Options/CodeActionOptions.cs diff --git a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs new file mode 100644 index 0000000000..4e04e6fcf7 --- /dev/null +++ b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs @@ -0,0 +1,9 @@ +using System.IO; + +namespace OmniSharp.Options +{ + public class CodeActionOptions + { + public string LocationPath { get; set; } + } +} diff --git a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs index d7b5099b91..43410ba935 100644 --- a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs +++ b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs @@ -4,6 +4,8 @@ namespace OmniSharp.Options { public class OmniSharpOptions { + public CodeActionOptions CodeActions { get; set; } + public FormattingOptions FormattingOptions { get; } public OmniSharpOptions() : this(new FormattingOptions()) { } diff --git a/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs b/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs index 7044fcfcca..08e7399c4a 100644 --- a/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs +++ b/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs @@ -7,6 +7,8 @@ namespace OmniSharp.Services public interface IAssemblyLoader { Assembly Load(AssemblyName name); + + IEnumerable LoadAll(string folderPath); } public static class IAssemblyLoaderExtensions diff --git a/src/OmniSharp.Host/Services/AssemblyLoader.cs b/src/OmniSharp.Host/Services/AssemblyLoader.cs index 36e3595bd0..2675357ade 100644 --- a/src/OmniSharp.Host/Services/AssemblyLoader.cs +++ b/src/OmniSharp.Host/Services/AssemblyLoader.cs @@ -1,4 +1,7 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.IO; using System.Reflection; using Microsoft.Extensions.Logging; using OmniSharp.Services; @@ -11,7 +14,7 @@ internal class AssemblyLoader : IAssemblyLoader public AssemblyLoader(ILoggerFactory loggerFactory) { - this._logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.CreateLogger(); } public Assembly Load(AssemblyName name) @@ -30,5 +33,43 @@ public Assembly Load(AssemblyName name) _logger.LogTrace($"Assembly loaded: {name}"); return result; } + + public IEnumerable LoadAll(string folderPath) + { + if (folderPath == null) return Enumerable.Empty(); + + var assemblies = new List(); + foreach (var filePath in Directory.EnumerateFiles(folderPath, "*.dll")) + { + var assembly = LoadFromPath(filePath); + if (assembly != null) + { + assemblies.Add(assembly); + } + } + + return assemblies; + } + + private Assembly LoadFromPath(string assemblyPath) + { + Assembly assembly = null; + + try + { +#if NET46 + assembly = Assembly.LoadFrom(assemblyPath); +#else + assembly = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); +#endif + } + catch (Exception ex) + { + _logger.LogError(ex, $"Failed to load assembly from path: {assemblyPath}"); + } + + _logger.LogTrace($"Assembly loaded from path: {assemblyPath}"); + return assembly; + } } } diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs index 356812c96d..4d1c09f018 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs @@ -1,6 +1,7 @@ using System.Collections.Immutable; using System.Composition; using System.Reflection; +using OmniSharp.Options; using OmniSharp.Services; namespace OmniSharp.Roslyn.CSharp.Services @@ -12,7 +13,7 @@ public class RoslynFeaturesHostServicesProvider : IHostServicesProvider public ImmutableArray Assemblies { get; } [ImportingConstructor] - public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader) + public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptions options) { var builder = ImmutableArray.CreateBuilder(); @@ -21,6 +22,11 @@ public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader) builder.AddRange(loader.Load(Features, CSharpFeatures)); + if (options?.CodeActions.LocationPath != null) + { + builder.AddRange(loader.LoadAll(options.CodeActions.LocationPath)); + } + this.Assemblies = builder.ToImmutable(); } } diff --git a/src/OmniSharp/app.config b/src/OmniSharp/app.config index b886ce469e..7d957b3f31 100644 --- a/src/OmniSharp/app.config +++ b/src/OmniSharp/app.config @@ -3,4 +3,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file From 71342f1642820d0715a5fd95acc4928a35c89d53 Mon Sep 17 00:00:00 2001 From: filipw Date: Fri, 5 May 2017 13:25:57 +0200 Subject: [PATCH 2/7] moved to multi folder support --- .../Options/CodeActionOptions.cs | 24 +++++++++++++++++-- .../RoslynFeaturesHostServicesProvider.cs | 11 ++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs index 4e04e6fcf7..bf7e7b6797 100644 --- a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs +++ b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs @@ -1,9 +1,29 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; +using System.Linq; namespace OmniSharp.Options { public class CodeActionOptions { - public string LocationPath { get; set; } + public string[] LocationPaths { get; set; } + + public IEnumerable GetLocations(IOmniSharpEnvironment env) + { + if (LocationPaths == null) return Enumerable.Empty(); + + var normalizePaths = new HashSet(); + foreach (var locationPath in LocationPaths) + { + if (Path.IsPathRooted(locationPath)) + { + normalizePaths.Add(locationPath); + } + + normalizePaths.Add(Path.Combine(env.TargetDirectory, locationPath)); + } + + return normalizePaths; + } } } diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs index 4d1c09f018..ebb57ae18a 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs @@ -3,6 +3,7 @@ using System.Reflection; using OmniSharp.Options; using OmniSharp.Services; +using System.Linq; namespace OmniSharp.Roslyn.CSharp.Services { @@ -13,7 +14,7 @@ public class RoslynFeaturesHostServicesProvider : IHostServicesProvider public ImmutableArray Assemblies { get; } [ImportingConstructor] - public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptions options) + public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptions options, IOmniSharpEnvironment env) { var builder = ImmutableArray.CreateBuilder(); @@ -22,9 +23,13 @@ public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptio builder.AddRange(loader.Load(Features, CSharpFeatures)); - if (options?.CodeActions.LocationPath != null) + var codeActionLocations = options?.CodeActions.GetLocations(env); + if (codeActionLocations != null && codeActionLocations.Any()) { - builder.AddRange(loader.LoadAll(options.CodeActions.LocationPath)); + foreach (var codeActionLocation in codeActionLocations) + { + builder.AddRange(loader.LoadAll(codeActionLocation)); + } } this.Assemblies = builder.ToImmutable(); From 1c7ec8cda266be9b468218ee161b25fc655f5529 Mon Sep 17 00:00:00 2001 From: filipw Date: Fri, 5 May 2017 13:42:26 +0200 Subject: [PATCH 3/7] fixed null ref --- src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs | 2 +- .../Services/RoslynFeaturesHostServicesProvider.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs index 43410ba935..f1f0822d98 100644 --- a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs +++ b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs @@ -4,7 +4,7 @@ namespace OmniSharp.Options { public class OmniSharpOptions { - public CodeActionOptions CodeActions { get; set; } + public CodeActionOptions CodeActions { get; set; } = new CodeActionOptions(); public FormattingOptions FormattingOptions { get; } diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs index ebb57ae18a..4ab5c3e8d8 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs @@ -23,7 +23,7 @@ public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptio builder.AddRange(loader.Load(Features, CSharpFeatures)); - var codeActionLocations = options?.CodeActions.GetLocations(env); + var codeActionLocations = options.CodeActions.GetLocations(env); if (codeActionLocations != null && codeActionLocations.Any()) { foreach (var codeActionLocation in codeActionLocations) From f51ad56a42830e17129c037c5257124eef53681d Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 15 May 2017 17:01:12 +0200 Subject: [PATCH 4/7] addressed some CR --- .../Options/CodeActionOptions.cs | 17 ++++++---- .../Options/OmniSharpOptions.cs | 11 ++---- .../Services/IAssemblyLoader.cs | 2 +- src/OmniSharp.Host/Services/AssemblyLoader.cs | 4 +-- .../ExternalFeaturesHostServicesProvider.cs | 34 +++++++++++++++++++ .../RoslynFeaturesHostServicesProvider.cs | 13 ++----- 6 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs diff --git a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs index bf7e7b6797..ee02cc1906 100644 --- a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs +++ b/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,21 +9,23 @@ public class CodeActionOptions { public string[] LocationPaths { get; set; } - public IEnumerable GetLocations(IOmniSharpEnvironment env) + public IEnumerable GetNormalizedLocationPaths(IOmniSharpEnvironment env) { - if (LocationPaths == null) return Enumerable.Empty(); + if (LocationPaths == null || LocationPaths.Length == 0) return Enumerable.Empty(); - var normalizePaths = new HashSet(); + var normalizePaths = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var locationPath in LocationPaths) { if (Path.IsPathRooted(locationPath)) { normalizePaths.Add(locationPath); } - - normalizePaths.Add(Path.Combine(env.TargetDirectory, locationPath)); + else + { + normalizePaths.Add(Path.Combine(env.TargetDirectory, locationPath)); + } } - + return normalizePaths; } } diff --git a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs index f1f0822d98..cba7e68e6e 100644 --- a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs +++ b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs @@ -4,15 +4,8 @@ namespace OmniSharp.Options { public class OmniSharpOptions { - public CodeActionOptions CodeActions { get; set; } = new CodeActionOptions(); + public CodeActionOptions CodeActions { get; } = new CodeActionOptions(); - public FormattingOptions FormattingOptions { get; } - - public OmniSharpOptions() : this(new FormattingOptions()) { } - - public OmniSharpOptions(FormattingOptions options) - { - FormattingOptions = options ?? throw new ArgumentNullException(nameof(options)); - } + public FormattingOptions FormattingOptions { get; } = new FormattingOptions(); } } diff --git a/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs b/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs index 08e7399c4a..f49859e6cf 100644 --- a/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs +++ b/src/OmniSharp.Abstractions/Services/IAssemblyLoader.cs @@ -8,7 +8,7 @@ public interface IAssemblyLoader { Assembly Load(AssemblyName name); - IEnumerable LoadAll(string folderPath); + IReadOnlyList LoadAllFrom(string folderPath); } public static class IAssemblyLoaderExtensions diff --git a/src/OmniSharp.Host/Services/AssemblyLoader.cs b/src/OmniSharp.Host/Services/AssemblyLoader.cs index 2675357ade..6a9d6c43a3 100644 --- a/src/OmniSharp.Host/Services/AssemblyLoader.cs +++ b/src/OmniSharp.Host/Services/AssemblyLoader.cs @@ -34,9 +34,9 @@ public Assembly Load(AssemblyName name) return result; } - public IEnumerable LoadAll(string folderPath) + public IReadOnlyList LoadAllFrom(string folderPath) { - if (folderPath == null) return Enumerable.Empty(); + if (string.IsNullOrWhiteSpace(folderPath)) return new Assembly[0]; var assemblies = new List(); foreach (var filePath in Directory.EnumerateFiles(folderPath, "*.dll")) diff --git a/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs new file mode 100644 index 0000000000..fe579f23c9 --- /dev/null +++ b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs @@ -0,0 +1,34 @@ +using System.Collections.Immutable; +using System.Composition; +using System.Reflection; +using OmniSharp.Options; +using OmniSharp.Services; +using System.Linq; + +namespace OmniSharp.Roslyn.CSharp.Services +{ + [Export(typeof(IHostServicesProvider))] + [Export(typeof(ExternalFeaturesHostServicesProvider))] + [Shared] + public class ExternalFeaturesHostServicesProvider : IHostServicesProvider + { + public ImmutableArray Assemblies { get; } + + [ImportingConstructor] + public ExternalFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptions options, IOmniSharpEnvironment env) + { + var builder = ImmutableArray.CreateBuilder(); + + var codeActionLocations = options.CodeActions.GetNormalizedLocationPaths(env); + if (codeActionLocations?.Any() == true) + { + foreach (var codeActionLocation in codeActionLocations) + { + builder.AddRange(loader.LoadAllFrom(codeActionLocation)); + } + } + + Assemblies = builder.ToImmutable(); + } + } +} diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs index 4ab5c3e8d8..c3ceea4f22 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs @@ -9,12 +9,13 @@ namespace OmniSharp.Roslyn.CSharp.Services { [Export(typeof(IHostServicesProvider))] [Export(typeof(RoslynFeaturesHostServicesProvider))] + [Shared] public class RoslynFeaturesHostServicesProvider : IHostServicesProvider { public ImmutableArray Assemblies { get; } [ImportingConstructor] - public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptions options, IOmniSharpEnvironment env) + public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader) { var builder = ImmutableArray.CreateBuilder(); @@ -23,16 +24,8 @@ public RoslynFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOptio builder.AddRange(loader.Load(Features, CSharpFeatures)); - var codeActionLocations = options.CodeActions.GetLocations(env); - if (codeActionLocations != null && codeActionLocations.Any()) - { - foreach (var codeActionLocation in codeActionLocations) - { - builder.AddRange(loader.LoadAll(codeActionLocation)); - } - } - this.Assemblies = builder.ToImmutable(); + Assemblies = builder.ToImmutable(); } } } From 0df59c07e8b31b059e59db1177f8f541c6bbbd4a Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 15 May 2017 17:07:39 +0200 Subject: [PATCH 5/7] added ExternalCodeActionProvider --- .../CodeActions/ExternalCodeActionProvider.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/OmniSharp.Roslyn.CSharp/CodeActions/ExternalCodeActionProvider.cs diff --git a/src/OmniSharp.Roslyn.CSharp/CodeActions/ExternalCodeActionProvider.cs b/src/OmniSharp.Roslyn.CSharp/CodeActions/ExternalCodeActionProvider.cs new file mode 100644 index 0000000000..a9c2d2c377 --- /dev/null +++ b/src/OmniSharp.Roslyn.CSharp/CodeActions/ExternalCodeActionProvider.cs @@ -0,0 +1,15 @@ +using System.Composition; +using OmniSharp.Services; + +namespace OmniSharp.Roslyn.CSharp.Services.CodeActions +{ + [Export(typeof(ICodeActionProvider))] + public class ExternalCodeActionProvider : AbstractCodeActionProvider + { + [ImportingConstructor] + public ExternalCodeActionProvider(ExternalFeaturesHostServicesProvider featuresHostServicesProvider) + : base("ExternalCodeActions", featuresHostServicesProvider.Assemblies) + { + } + } +} From da1bdb62881fc723689871320a1a735676bc322b Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 15 May 2017 17:10:10 +0200 Subject: [PATCH 6/7] CodeActionOptions -> RoslynExtensionsOptions --- src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs | 2 +- .../{CodeActionOptions.cs => RoslynExtensionsOptions.cs} | 2 +- .../Services/ExternalFeaturesHostServicesProvider.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/OmniSharp.Abstractions/Options/{CodeActionOptions.cs => RoslynExtensionsOptions.cs} (95%) diff --git a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs index cba7e68e6e..d2fb9e8ae8 100644 --- a/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs +++ b/src/OmniSharp.Abstractions/Options/OmniSharpOptions.cs @@ -4,7 +4,7 @@ namespace OmniSharp.Options { public class OmniSharpOptions { - public CodeActionOptions CodeActions { get; } = new CodeActionOptions(); + public RoslynExtensionsOptions RoslynExtensionsOptions { get; } = new RoslynExtensionsOptions(); public FormattingOptions FormattingOptions { get; } = new FormattingOptions(); } diff --git a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs b/src/OmniSharp.Abstractions/Options/RoslynExtensionsOptions.cs similarity index 95% rename from src/OmniSharp.Abstractions/Options/CodeActionOptions.cs rename to src/OmniSharp.Abstractions/Options/RoslynExtensionsOptions.cs index ee02cc1906..0072724225 100644 --- a/src/OmniSharp.Abstractions/Options/CodeActionOptions.cs +++ b/src/OmniSharp.Abstractions/Options/RoslynExtensionsOptions.cs @@ -5,7 +5,7 @@ namespace OmniSharp.Options { - public class CodeActionOptions + public class RoslynExtensionsOptions { public string[] LocationPaths { get; set; } diff --git a/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs index fe579f23c9..8843ab1aea 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs @@ -19,12 +19,12 @@ public ExternalFeaturesHostServicesProvider(IAssemblyLoader loader, OmniSharpOpt { var builder = ImmutableArray.CreateBuilder(); - var codeActionLocations = options.CodeActions.GetNormalizedLocationPaths(env); - if (codeActionLocations?.Any() == true) + var roslynExtensionsLocations = options.RoslynExtensionsOptions.GetNormalizedLocationPaths(env); + if (roslynExtensionsLocations?.Any() == true) { - foreach (var codeActionLocation in codeActionLocations) + foreach (var roslynExtensionsLocation in roslynExtensionsLocations) { - builder.AddRange(loader.LoadAllFrom(codeActionLocation)); + builder.AddRange(loader.LoadAllFrom(roslynExtensionsLocation)); } } From 5d9b63ae8449ab30ddef9daf5ce56c7f3dc5c6a9 Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 17 May 2017 18:54:54 +0300 Subject: [PATCH 7/7] minor cleanup --- src/OmniSharp.Host/Services/AssemblyLoader.cs | 2 +- .../Services/ExternalFeaturesHostServicesProvider.cs | 2 +- .../Services/RoslynFeaturesHostServicesProvider.cs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/OmniSharp.Host/Services/AssemblyLoader.cs b/src/OmniSharp.Host/Services/AssemblyLoader.cs index 6a9d6c43a3..3f3ecf5d48 100644 --- a/src/OmniSharp.Host/Services/AssemblyLoader.cs +++ b/src/OmniSharp.Host/Services/AssemblyLoader.cs @@ -36,7 +36,7 @@ public Assembly Load(AssemblyName name) public IReadOnlyList LoadAllFrom(string folderPath) { - if (string.IsNullOrWhiteSpace(folderPath)) return new Assembly[0]; + if (string.IsNullOrWhiteSpace(folderPath)) return Array.Empty(); var assemblies = new List(); foreach (var filePath in Directory.EnumerateFiles(folderPath, "*.dll")) diff --git a/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs index 8843ab1aea..0a7c457e70 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/ExternalFeaturesHostServicesProvider.cs @@ -1,9 +1,9 @@ using System.Collections.Immutable; using System.Composition; +using System.Linq; using System.Reflection; using OmniSharp.Options; using OmniSharp.Services; -using System.Linq; namespace OmniSharp.Roslyn.CSharp.Services { diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs index c3ceea4f22..a0f4cf8b0c 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/RoslynFeaturesHostServicesProvider.cs @@ -3,7 +3,6 @@ using System.Reflection; using OmniSharp.Options; using OmniSharp.Services; -using System.Linq; namespace OmniSharp.Roslyn.CSharp.Services {