diff --git a/build/Packages.props b/build/Packages.props
index ea66b1fb37..e20ddb18aa 100644
--- a/build/Packages.props
+++ b/build/Packages.props
@@ -7,7 +7,7 @@
17.0.0
17.0.0
6.0.0
- 4.1.0-3.22069.8
+ 4.2.0-1.22074.8
2.4.1
diff --git a/src/OmniSharp.Abstractions/Configuration.cs b/src/OmniSharp.Abstractions/Configuration.cs
index c699379f6c..9d53c75e30 100644
--- a/src/OmniSharp.Abstractions/Configuration.cs
+++ b/src/OmniSharp.Abstractions/Configuration.cs
@@ -4,7 +4,7 @@ internal static class Configuration
{
public static bool ZeroBasedIndices = false;
- public const string RoslynVersion = "4.1.0.0";
+ public const string RoslynVersion = "4.2.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";
public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
diff --git a/src/OmniSharp.Http.Driver/app.config b/src/OmniSharp.Http.Driver/app.config
index 03c57f87a8..1a5e2cce80 100644
--- a/src/OmniSharp.Http.Driver/app.config
+++ b/src/OmniSharp.Http.Driver/app.config
@@ -7,23 +7,23 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/src/OmniSharp.LanguageServerProtocol/app.config b/src/OmniSharp.LanguageServerProtocol/app.config
index c9f7ab2fe5..5e9e816bcc 100644
--- a/src/OmniSharp.LanguageServerProtocol/app.config
+++ b/src/OmniSharp.LanguageServerProtocol/app.config
@@ -7,23 +7,23 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionService.cs b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionService.cs
index 4b75d44690..2ce0129c28 100644
--- a/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionService.cs
+++ b/src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionService.cs
@@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Completion;
@@ -22,7 +23,6 @@
using CompletionItem = OmniSharp.Models.v1.Completion.CompletionItem;
using CompletionTriggerKind = OmniSharp.Models.v1.Completion.CompletionTriggerKind;
using CSharpCompletionService = Microsoft.CodeAnalysis.Completion.CompletionService;
-using System.Threading;
using Roslyn.Utilities;
namespace OmniSharp.Roslyn.CSharp.Services.Completion
diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/RenameService.cs b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/RenameService.cs
index 815203cca3..7b2764aad6 100644
--- a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/RenameService.cs
+++ b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/RenameService.cs
@@ -2,15 +2,16 @@
using System.Collections.Generic;
using System.Composition;
using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp;
using Microsoft.CodeAnalysis.FindSymbols;
-using Microsoft.CodeAnalysis.Rename;
-using Microsoft.CodeAnalysis.Text;
using OmniSharp.Extensions;
using OmniSharp.Mef;
using OmniSharp.Models;
using OmniSharp.Models.Rename;
+using OmniSharp.Options;
using OmniSharp.Roslyn.Utilities;
namespace OmniSharp.Roslyn.CSharp.Services.Refactoring
@@ -19,11 +20,13 @@ namespace OmniSharp.Roslyn.CSharp.Services.Refactoring
public class RenameService : IRequestHandler
{
private readonly OmniSharpWorkspace _workspace;
+ private readonly OmniSharpOptions _omniSharpOptions;
[ImportingConstructor]
- public RenameService(OmniSharpWorkspace workspace)
+ public RenameService(OmniSharpWorkspace workspace, OmniSharpOptions omniSharpOptions)
{
_workspace = workspace;
+ _omniSharpOptions = omniSharpOptions;
}
public async Task Handle(RenameRequest request)
@@ -41,13 +44,17 @@ public async Task Handle(RenameRequest request)
if (symbol != null)
{
- try
- {
- solution = await Renamer.RenameSymbolAsync(solution, symbol, request.RenameTo, _workspace.Options);
- }
- catch (ArgumentException e)
+ var options = new OmniSharpRenameOptions(
+ RenameOverloads: _omniSharpOptions.RenameOptions.RenameOverloads,
+ RenameInStrings: _omniSharpOptions.RenameOptions.RenameInStrings,
+ RenameInComments: _omniSharpOptions.RenameOptions.RenameInComments);
+
+ (solution, response.ErrorMessage) = await OmniSharpRenamer.RenameSymbolAsync(solution, symbol, request.RenameTo, options, nonConflictSymbols: null, CancellationToken.None);
+
+ if (response.ErrorMessage is not null)
{
- response.ErrorMessage = e.Message;
+ // An error occurred. There are no changes to report.
+ return response;
}
}
diff --git a/src/OmniSharp.Roslyn.CSharp/Services/RenameWorkspaceOptionsProvider.cs b/src/OmniSharp.Roslyn.CSharp/Services/RenameWorkspaceOptionsProvider.cs
deleted file mode 100644
index ba7950fe33..0000000000
--- a/src/OmniSharp.Roslyn.CSharp/Services/RenameWorkspaceOptionsProvider.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Composition;
-using Microsoft.CodeAnalysis.Options;
-using OmniSharp.Options;
-using OmniSharp.Roslyn.Options;
-using RoslynRenameOptions = Microsoft.CodeAnalysis.Rename.RenameOptions;
-
-namespace OmniSharp.Roslyn.CSharp.Services
-{
- [Export(typeof(IWorkspaceOptionsProvider)), Shared]
- public class RenameWorkspaceOptionsProvider : IWorkspaceOptionsProvider
- {
- public int Order => 100;
-
- public OptionSet Process(OptionSet currentOptionSet, OmniSharpOptions omniSharpOptions, IOmniSharpEnvironment omnisharpEnvironment) =>
- currentOptionSet
- .WithChangedOption(RoslynRenameOptions.RenameInComments, omniSharpOptions.RenameOptions.RenameInComments)
- .WithChangedOption(RoslynRenameOptions.RenameInStrings, omniSharpOptions.RenameOptions.RenameInStrings)
- .WithChangedOption(RoslynRenameOptions.RenameOverloads, omniSharpOptions.RenameOptions.RenameOverloads);
- }
-}
diff --git a/src/OmniSharp.Stdio.Driver/app.config b/src/OmniSharp.Stdio.Driver/app.config
index 03c57f87a8..1a5e2cce80 100644
--- a/src/OmniSharp.Stdio.Driver/app.config
+++ b/src/OmniSharp.Stdio.Driver/app.config
@@ -7,23 +7,23 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/tests/app.config b/tests/app.config
index 50ceff5605..402dc2a6a5 100644
--- a/tests/app.config
+++ b/tests/app.config
@@ -7,23 +7,23 @@
-
+
-
+
-
+
-
+
-
+