Skip to content

Commit

Permalink
Upgrade Roslyn
Browse files Browse the repository at this point in the history
  • Loading branch information
aelij committed Oct 7, 2020
1 parent 2d72143 commit 9344ddc
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Deterministic>True</Deterministic>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<EditorPackageVersion>1.2.0</EditorPackageVersion>
<RoslynPackageVersion>3.7.0-4.final</RoslynPackageVersion>
<RoslynAssemblyVersion>3.7.0.0</RoslynAssemblyVersion>
<RoslynPackageVersion>3.8.0-3.final</RoslynPackageVersion>
<RoslynAssemblyVersion>3.8.0.0</RoslynAssemblyVersion>
<AvaloniaVersion>0.9.11</AvaloniaVersion>
<LangVersion>8.0</LangVersion>
<Nullable>Enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.302"
"version": "3.1.402"
}
}
}
5 changes: 2 additions & 3 deletions src/RoslynPad.Editor.Shared/SnippetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public SnippetManager()

public IEnumerable<CodeSnippet> Snippets => DefaultSnippets.Values;

public CodeSnippet FindSnippet(string name)
public CodeSnippet? FindSnippet(string name)
{
CodeSnippet snippet;
DefaultSnippets.TryGetValue(name, out snippet);
DefaultSnippets.TryGetValue(name, out var snippet);
return snippet;
}

Expand Down
6 changes: 3 additions & 3 deletions src/RoslynPad.Roslyn/CachedScriptMetadataResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public CachedScriptMetadataResolver(string workingDirectory, bool useCache = fal

public override bool ResolveMissingAssemblies => _inner.ResolveMissingAssemblies;

public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
public override PortableExecutableReference? ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
{
if (_cache == null)
{
return _inner.ResolveMissingAssembly(definition, referenceIdentity);
}

return _cache.GetOrAdd(referenceIdentity.ToString(),
_ => ImmutableArray.Create(_inner.ResolveMissingAssembly(definition, referenceIdentity))).FirstOrDefault();
_ => ImmutableArray.Create(_inner.ResolveMissingAssembly(definition, referenceIdentity)!)).FirstOrDefault();
}

public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
Expand Down Expand Up @@ -69,4 +69,4 @@ public override ImmutableArray<PortableExecutableReference> ResolveReference(str
return result;
}
}
}
}
26 changes: 5 additions & 21 deletions src/RoslynPad.Roslyn/CodeFixes/CodeFixService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private async Task AppendFixesAsync(
{
cancellationToken.ThrowIfCancellationRequested();

if (hasAnySharedFixer && fixerMap.Value.TryGetValue(diagnosticId, out var workspaceFixers))
if (hasAnySharedFixer && fixerMap!.Value.TryGetValue(diagnosticId, out var workspaceFixers))
{
allFixers.AddRange(workspaceFixers);
}
Expand Down Expand Up @@ -513,14 +513,14 @@ private async Task<bool> ContainsAnyFixAsync(

if (hasAnyProjectFixer)
{
allFixers = allFixers.AddRange(projectFixers);
allFixers = allFixers.AddRange(projectFixers!);
}

var dx = await diagnostic.ToDiagnosticAsync(document.Project, cancellationToken).ConfigureAwait(false);

if (hasConfigurationFixer)
{
foreach (var lazyConfigurationProvider in lazyConfigurationProviders.Value)
foreach (var lazyConfigurationProvider in lazyConfigurationProviders!.Value)
{
if (lazyConfigurationProvider.IsFixableDiagnostic(dx))
{
Expand Down Expand Up @@ -550,24 +550,8 @@ private async Task<bool> ContainsAnyFixAsync(
foreach (var fixer in allFixers)
{
await extensionManager.PerformActionAsync(fixer, () => fixer.RegisterCodeFixesAsync(context) ?? Task.CompletedTask).ConfigureAwait(false);
foreach (var fix in fixes)
{
if (!fix.Action.PerformFinalApplicabilityCheck)
{
return true;
}

// Have to see if this fix is still applicable. Jump to the foreground thread
// to make that check.
cancellationToken.ThrowIfCancellationRequested();

var applicable = fix.Action.IsApplicable(document.Project.Solution.Workspace);

if (applicable)
{
return true;
}
}
if (fixes.Count > 0)
return true;
}

return false;
Expand Down
1 change: 1 addition & 0 deletions src/RoslynPad.Roslyn/QuickInfo/QuickInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.DocumentationComments;
using Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
Expand Down
2 changes: 2 additions & 0 deletions src/RoslynPad.Roslyn/RoslynPad.Roslyn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="$(RoslynPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="$(RoslynPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynPackageVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="5.0.0-preview.8.20407.11" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0-preview.8.20407.11" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/RoslynPad/RoslynPad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.8.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.6" />
<PackageReference Include="Mono.Cecil" Version="0.10.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="1.7.0" />
</ItemGroup>
Expand Down

0 comments on commit 9344ddc

Please sign in to comment.