Skip to content

Commit

Permalink
Update Roslyn to version 4.9.0-1.23504.3 (#2567)
Browse files Browse the repository at this point in the history
* Update Roslyn to version 4.8.0-3.23475.6

* Workaround new internal DocumentId property.

* Update completion tests with expected text edit

* Workaround unexpected end of line in completion test

* Add parameter names

* Add workaround for LSP Completion test

* Fix typo

* Normalize completion source in tests.

* Update NormalizeNewlines to replace with "\n"

* Update to Roslyn 4.9.0-1.23504.3 and remove reflection

* Update the Roslyn version in our binding redirects
  • Loading branch information
JoeRobich authored Oct 4, 2023
1 parent 22424c7 commit 79106f6
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<MicrosoftTestPackageVersion>17.6.0</MicrosoftTestPackageVersion>
<MSBuildPackageVersion>17.3.2</MSBuildPackageVersion>
<NuGetPackageVersion>6.8.0-preview.1.69</NuGetPackageVersion>
<RoslynPackageVersion>4.8.0-1.23419.1</RoslynPackageVersion>
<RoslynPackageVersion>4.9.0-1.23504.3</RoslynPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.Abstractions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ internal static class Configuration
{
public static bool ZeroBasedIndices = false;

public const string RoslynVersion = "4.8.0.0";
public const string RoslynVersion = "4.9.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
Expand Down
14 changes: 7 additions & 7 deletions src/OmniSharp.Http.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
14 changes: 7 additions & 7 deletions src/OmniSharp.LanguageServerProtocol/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#nullable enable

using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Logging;
using OmniSharp.Mef;
using OmniSharp.Models.v1.SourceGeneratedFile;
using System.Collections.Generic;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Workspace;
using Microsoft.Extensions.Logging;
using OmniSharp.Mef;
using OmniSharp.Models.v1.SourceGeneratedFile;

namespace OmniSharp.Roslyn.CSharp.Services.Navigation
{
Expand Down Expand Up @@ -100,6 +101,10 @@ public Task<SourceGeneratedFileClosedResponse> Handle(SourceGeneratedFileClosedR
return SourceGeneratedFileClosedResponse.Instance;
}

private DocumentId GetId(SourceGeneratedFileInfo info) => DocumentId.CreateFromSerialized(ProjectId.CreateFromSerialized(info.ProjectGuid), info.DocumentGuid);
private static DocumentId GetId(SourceGeneratedFileInfo info) => OmniSharpDocumentId.CreateFromSerialized(
ProjectId.CreateFromSerialized(info.ProjectGuid),
info.DocumentGuid,
isSourceGenerated: true,
debugName: null);
}
}
14 changes: 7 additions & 7 deletions src/OmniSharp.Stdio.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
22 changes: 11 additions & 11 deletions tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using TestUtility;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -288,7 +288,7 @@ public async Task ImportCompletion_OnLine0(string filename)
Assert.Single(resolved.AdditionalTextEdits);
var additionalEdit = resolved.AdditionalTextEdits.First();
Assert.Equal(NormalizeNewlines("using System;\n\n"),
additionalEdit.NewText);
NormalizeNewlines(additionalEdit.NewText));
Assert.Equal(0, additionalEdit.Range.Start.Line);
Assert.Equal(0, additionalEdit.Range.Start.Character);
Assert.Equal(0, additionalEdit.Range.End.Line);
Expand Down Expand Up @@ -375,12 +375,12 @@ public class C3

Assert.Single(resolved.AdditionalTextEdits);
var additionalEdit = resolved.AdditionalTextEdits.First();
Assert.Equal(NormalizeNewlines("N2;\nusing "),
Assert.Equal(NormalizeNewlines("using N2;\n"),
additionalEdit.NewText);
Assert.Equal(1, additionalEdit.Range.Start.Line);
Assert.Equal(6, additionalEdit.Range.Start.Character);
Assert.Equal(0, additionalEdit.Range.Start.Character);
Assert.Equal(1, additionalEdit.Range.End.Line);
Assert.Equal(6, additionalEdit.Range.End.Character);
Assert.Equal(0, additionalEdit.Range.End.Character);
VerifySortOrders(completions.Items);
}

Expand Down Expand Up @@ -1530,7 +1530,7 @@ public void M()
protected async Task<CompletionList> FindCompletionsAsync(string filename, string source, char? triggerChar = null, TestFile[] additionalFiles = null)
{
var bufferPath = $"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}somepath{Path.DirectorySeparatorChar}{filename}";
var testFile = new TestFile(bufferPath, source);
var testFile = new TestFile(bufferPath, NormalizeNewlines(source));

var files = new[] { testFile };
if (additionalFiles is object)
Expand Down Expand Up @@ -1588,7 +1588,7 @@ private async Task EnableImportCompletion()
}

private static string NormalizeNewlines(string str)
=> str.Replace("\r\n", Environment.NewLine);
=> str.Replace("\r\n", "\n");

private static void VerifySortOrders(IEnumerable<CompletionItem> items)
{
Expand Down
12 changes: 6 additions & 6 deletions tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public async Task ImportCompletion_OnLine0(string filename, bool useAsyncComplet
Assert.Single(resolved.Item.AdditionalTextEdits);
var additionalEdit = resolved.Item.AdditionalTextEdits[0];
Assert.Equal(NormalizeNewlines("using System;\n\n"),
additionalEdit.NewText);
NormalizeNewlines(additionalEdit.NewText));
Assert.Equal(0, additionalEdit.StartLine);
Assert.Equal(0, additionalEdit.StartColumn);
Assert.Equal(0, additionalEdit.EndLine);
Expand Down Expand Up @@ -395,12 +395,12 @@ public class C3

Assert.Single(resolved.Item.AdditionalTextEdits);
var additionalEdit = resolved.Item.AdditionalTextEdits[0];
Assert.Equal(NormalizeNewlines("N2;\nusing "),
Assert.Equal(NormalizeNewlines("using N2;\n"),
additionalEdit.NewText);
Assert.Equal(1, additionalEdit.StartLine);
Assert.Equal(6, additionalEdit.StartColumn);
Assert.Equal(0, additionalEdit.StartColumn);
Assert.Equal(1, additionalEdit.EndLine);
Assert.Equal(6, additionalEdit.EndColumn);
Assert.Equal(0, additionalEdit.EndColumn);
VerifySortOrders(completions.Items);
}

Expand Down Expand Up @@ -2273,7 +2273,7 @@ private CompletionService GetCompletionService(OmniSharpTestHost host)

protected async Task<CompletionResponse> FindCompletionsAsync(string filename, string source, OmniSharpTestHost testHost, char? triggerChar = null, TestFile[] additionalFiles = null, bool forceExpandedCompletionIndexCreation = false)
{
var testFile = new TestFile(filename, source);
var testFile = new TestFile(filename, NormalizeNewlines(source));

var files = new[] { testFile };
if (additionalFiles is object)
Expand Down Expand Up @@ -2331,7 +2331,7 @@ private Task<CompletionAfterInsertResponse> AfterInsertResponse(CompletionItem c
}

private static string NormalizeNewlines(string str)
=> str.Replace("\r\n", Environment.NewLine);
=> str.Replace("\r\n", "\n");

private static void VerifySortOrders(IReadOnlyList<CompletionItem> items)
{
Expand Down
14 changes: 7 additions & 7 deletions tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.ExternalAccess.OmniSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.8.0.0" newVersion="4.8.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.9.0.0" newVersion="4.9.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
Expand Down

0 comments on commit 79106f6

Please sign in to comment.