Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Roslyn to 4.4.0 1.22369.1 #2420

Merged
merged 14 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
All changes to the project will be documented in this file.

## [1.39.1]
* Update Roslyn to 4.4.0 1.22369.1 (PR: [#2420](https://github.com/OmniSharp/omnisharp-roslyn/pull/2420))
* Simplify some code (PR: [#2370](https://github.com/OmniSharp/omnisharp-roslyn/pull/2370))
* Return meaningful error when pinned SDK version is not found. ([[omnisharp-vscode#5128](https://github.com/OmniSharp/omnisharp-vscode/issues/5128), PR: [#2403](https://github.com/OmniSharp/omnisharp-roslyn/pull/2403))
* Added support for `<WarningsAsErrors>nullable</WarningsAsErrors>` ([#2292](https://github.com/OmniSharp/omnisharp-roslyn/issues/2292), PR: [#2406](https://github.com/OmniSharp/omnisharp-roslyn/pull/2406))
* Removed nuget versioning reference from OmniSharp.Abstractions ([#2410](https://github.com/OmniSharp/omnisharp-roslyn/issues/2410), PR: [#2414](https://github.com/OmniSharp/omnisharp-roslyn/pull/2414))
* Bump Newtonsoft.Json to 13.0.1 (PR: [#2415](https://github.com/OmniSharp/omnisharp-roslyn/pull/2415))

## [1.39.0] - 2022-05-19
* Update Roslyn to 4.3.0-2.22267.5 (PR: [#2401](https://github.com/OmniSharp/omnisharp-roslyn/pull/2401))
* Fixed run script for Mono ([OmniSharp/omnisharp-vscode#5181](https://github.com/OmniSharp/omnisharp-vscode/issues/5181), [OmniSharp/omnisharp-vscode#5179](https://github.com/OmniSharp/omnisharp-vscode/issues/5179), PR: [#2398](https://github.com/OmniSharp/omnisharp-roslyn/pull/2398))
* Fixed run script for Mono ([omnisharp-vscode#5181](https://github.com/OmniSharp/omnisharp-vscode/issues/5181), [omnisharp-vscode#5179](https://github.com/OmniSharp/omnisharp-vscode/issues/5179), PR: [#2398](https://github.com/OmniSharp/omnisharp-roslyn/pull/2398))
* Fall back to /usr/lib/os-release if /etc/os-release doesn't exist (PR: [#2380](https://github.com/OmniSharp/omnisharp-roslyn/pull/2380))
* Added support for linux-musl-x64 and linux-musl-arm64 ([#2366](https://github.com/OmniSharp/omnisharp-roslyn/issues/2366), PR: [#2395](https://github.com/OmniSharp/omnisharp-roslyn/pull/2395))
* Enable GoToDefinition for symbols in metadata documents ([OmniSharp/omnisharp-vscode#4818](https://github.com/OmniSharp/omnisharp-vscode/issues/4818), PR: [#2390](https://github.com/OmniSharp/omnisharp-roslyn/pull/2390))
* Enable GoToDefinition for symbols in metadata documents ([omnisharp-vscode#4818](https://github.com/OmniSharp/omnisharp-vscode/issues/4818), PR: [#2390](https://github.com/OmniSharp/omnisharp-roslyn/pull/2390))
* Use human readable doc in lsp's signature help ([#2372](https://github.com/OmniSharp/omnisharp-roslyn/issues/2372), PR: [#2392](https://github.com/OmniSharp/omnisharp-roslyn/pull/2392))
* Add TextEdits support to InlayHints (PR: [#2385](https://github.com/OmniSharp/omnisharp-roslyn/pull/2385))
* Fix Equals of AutoCompleteResponse and simplify some code (PR: [#2362](https://github.com/OmniSharp/omnisharp-roslyn/pull/2362))
Expand Down
2 changes: 1 addition & 1 deletion build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MicrosoftTestPackageVersion>17.2.0</MicrosoftTestPackageVersion>
<MSBuildPackageVersion>17.0.0</MSBuildPackageVersion>
<NuGetPackageVersion>6.3.0-preview.1.32</NuGetPackageVersion>
<RoslynPackageVersion>4.3.0-2.22267.5</RoslynPackageVersion>
<RoslynPackageVersion>4.4.0-1.22369.1</RoslynPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "7.0.100-preview.4.22252.9"
"version": "7.0.100-preview.4.22252.9",
"rollForward": "patch"
}
}
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.3.0.0";
public const string RoslynVersion = "4.4.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
Expand Down
10 changes: 5 additions & 5 deletions src/OmniSharp.Http.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
10 changes: 5 additions & 5 deletions src/OmniSharp.LanguageServerProtocol/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.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
Expand Up @@ -28,14 +28,14 @@ internal static partial class CompletionListBuilder
TextSpan typedSpan,
bool expectingImportedItems, bool isSuggestionMode)
{
var completionsBuilder = new List<CompletionItem>(completions.Items.Length);
var completionsBuilder = new List<CompletionItem>(completions.ItemsList.Count);
var seenUnimportedCompletions = false;
var commitCharacterRuleCache = new Dictionary<ImmutableArray<CharacterSetModificationRule>, IReadOnlyList<char>>();
var commitCharacterRuleBuilder = new HashSet<char>();

for (int i = 0; i < completions.Items.Length; i++)
for (int i = 0; i < completions.ItemsList.Count; i++)
{
var completion = completions.Items[i];
var completion = completions.ItemsList[i];
string labelText = completion.DisplayTextPrefix + completion.DisplayText + completion.DisplayTextSuffix;
string? insertText;
string? filterText = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,32 @@ internal static partial class CompletionListBuilder
bool expectingImportedItems,
bool isSuggestionMode)
{
var completionsBuilder = new List<CompletionItem>(completions.Items.Length);
var completionsBuilder = new List<CompletionItem>(completions.ItemsList.Count);
var seenUnimportedCompletions = false;
var commitCharacterRuleCache = new Dictionary<ImmutableArray<CharacterSetModificationRule>, IReadOnlyList<char>>();
var commitCharacterRuleBuilder = new HashSet<char>();

var completionTasksAndProviderNames = completions.Items.SelectAsArray((document, completionService), (completion, arg) =>
var completionTasksAndProviderNamesBuilder = ImmutableArray.CreateBuilder<(Task<CompletionChange>?, string? providerName)>();
for (int i = 0; i < completions.ItemsList.Count; i++)
{
var completion = completions.ItemsList[i];
var providerName = completion.GetProviderName();
if (providerName is TypeImportCompletionProvider or
ExtensionMethodImportCompletionProvider)
{
return (null, providerName);
completionTasksAndProviderNamesBuilder.Add((null, providerName));
}
else
{
return ((Task<CompletionChange>?)arg.completionService.GetChangeAsync(arg.document, completion), providerName);
completionTasksAndProviderNamesBuilder.Add(((Task<CompletionChange>?)completionService.GetChangeAsync(document, completion), providerName));
}
});
}
var completionTasksAndProviderNames = completionTasksAndProviderNamesBuilder.ToImmutable();
filipw marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filipw why did you revert this? Just to see if it would fix the OOM issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it failed many tests with System.InvalidOperationException : MoveToImmutable can only be performed when Count equals Capacity.


for (int i = 0; i < completions.Items.Length; i++)
for (int i = 0; i < completions.ItemsList.Count; i++)
{
TextSpan changeSpan = typedSpan;
var completion = completions.Items[i];
var completion = completions.ItemsList[i];
var insertTextFormat = InsertTextFormat.PlainText;
string labelText = completion.DisplayTextPrefix + completion.DisplayText + completion.DisplayTextSuffix;
List<LinePositionSpanTextChange>? additionalTextEdits = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ public async Task<CompletionResponse> Handle(CompletionRequest request, bool for

var completions = await OmniSharpCompletionService.GetCompletionsAsync(completionService, document, position, trigger, roles: null, options, CancellationToken.None);
_logger.LogTrace("Found {0} completions for {1}:{2},{3}",
completions?.Items.IsDefaultOrEmpty != false ? 0 : completions.Items.Length,
completions.ItemsList.Count,
request.FileName,
request.Line,
request.Column);

if (completions is null || completions.Items.Length == 0)
if (completions is null || completions.ItemsList.Count == 0)
{
return new CompletionResponse { Items = ImmutableArray<CompletionItem>.Empty };
}

if (request.TriggerCharacter == ' ' && !completions.Items.Any(c =>
if (request.TriggerCharacter == ' ' && !completions.ItemsList.Any(c =>
{
var providerName = c.GetProviderName();
return providerName is CompletionListBuilder.OverrideCompletionProvider or
Expand Down Expand Up @@ -166,14 +166,14 @@ public async Task<CompletionResolveResponse> Handle(CompletionResolveRequest req
var index = request.Item.Data.Index;

if (request.Item is null
|| index >= completions.Items.Length
|| index >= completions.ItemsList.Count
|| index < 0)
{
_logger.LogError("Received invalid completion resolve!");
return new CompletionResolveResponse { Item = request.Item };
}

var lastCompletionItem = completions.Items[index];
var lastCompletionItem = completions.ItemsList[index];
if (lastCompletionItem.DisplayTextPrefix + lastCompletionItem.DisplayText + lastCompletionItem.DisplayTextSuffix != request.Item.Label)
{
_logger.LogError("Inconsistent completion data. Requested data on {0}, but found completion item {1}", request.Item.Label, lastCompletionItem.DisplayText);
Expand Down Expand Up @@ -234,15 +234,15 @@ public async Task<CompletionAfterInsertResponse> Handle(CompletionAfterInsertReq
var index = request.Item.Data.Index;

if (request.Item is null
|| index >= completions.Items.Length
|| index >= completions.ItemsList.Count
|| index < 0
|| request.Item.TextEdit is null)
{
_logger.LogError("Received invalid completion afterInsert!");
return new CompletionAfterInsertResponse();
}

var lastCompletionItem = completions.Items[index];
var lastCompletionItem = completions.ItemsList[index];
if (lastCompletionItem.DisplayTextPrefix + lastCompletionItem.DisplayText + lastCompletionItem.DisplayTextSuffix != request.Item.Label)
{
_logger.LogError("Inconsistent completion data. Requested data on {0}, but found completion item {1}", request.Item.Label, lastCompletionItem.DisplayText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,20 @@ private bool HasFix(CodeFixProvider codeFixProvider, string diagnosticId)

private async Task CollectRefactoringActions(Document document, TextSpan span, List<CodeAction> codeActions)
{
var codeActionOptions = CodeActionOptionsFactory.Create(Options);
var availableRefactorings = OrderedCodeRefactoringProviders.Value;

foreach (var codeRefactoringProvider in availableRefactorings)
{
try
{
var context = new CodeRefactoringContext(document, span, a => codeActions.Add(a), CancellationToken.None);
var context = OmniSharpCodeFixContextFactory.CreateCodeRefactoringContext(
document,
span,
(a, _) => codeActions.Add(a),
codeActionOptions,
CancellationToken.None);

await codeRefactoringProvider.ComputeRefactoringsAsync(context);
}
catch (Exception ex)
Expand Down
Loading