Skip to content

Commit

Permalink
Merge pull request #59092 from dotnet/merges/main-to-features/RawStri…
Browse files Browse the repository at this point in the history
…ngLiterals

Merge main to features/RawStringLiterals
  • Loading branch information
dotnet-bot authored Jan 27, 2022
2 parents 65e3ea0 + e1cfa48 commit 69bc730
Show file tree
Hide file tree
Showing 108 changed files with 847 additions and 1,114 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/dotnet/.devcontainer/base.Dockerfile

# [Choice] .NET version: 6.0, 5.0, 3.1, 2.1
ARG VARIANT="6.0"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}

# Set up machine requirements to build the repo
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends cmake llvm-9 clang-9 \
build-essential python curl git lldb-6.0 liblldb-6.0-dev \
libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev \
libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja-build

# Install V8 Engine
SHELL ["/bin/bash", "-c"]

RUN curl -sSL "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/chromium-v8/v8-linux64-rel-8.5.183.zip" -o ./v8.zip \
&& unzip ./v8.zip -d /usr/local/v8 \
&& echo $'#!/usr/bin/env bash\n\
"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \
&& chmod +x /usr/local/bin/v8
57 changes: 57 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/dotnetcore
{
"name": "C# (.NET 6)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "6.0",
}
},
"settings": {
"files.associations": {
"*.csproj": "msbuild",
"*.fsproj": "msbuild",
"*.globalconfig": "ini",
"*.manifest": "xml",
"*.nuspec": "xml",
"*.pkgdef": "ini",
"*.projitems": "msbuild",
"*.props": "msbuild",
"*.resx": "xml",
"*.rsp": "Powershell",
"*.ruleset": "xml",
"*.settings": "xml",
"*.shproj": "msbuild",
"*.slnf": "json",
"*.targets": "msbuild",
"*.vbproj": "msbuild",
"*.vsixmanifest": "xml",
"*.vstemplate": "xml",
"*.xlf": "xml",
"*.yml": "azure-pipelines"
},
// ms-dotnettools.csharp settings
"omnisharp.defaultLaunchSolution": "Compilers.sln",
"omnisharp.disableMSBuildDiagnosticWarning": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableImportCompletion": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.useModernNet": true,
"omnisharp.enableAsyncCompletion": true,
// ms-vscode.powershell settings
"powershell.promptToUpdatePowerShell": false,
"powershell.integratedConsole.showOnStartup": false,
"powershell.startAutomatically": false,
// ms-azure-devops.azure-pipelines settings
"azure-pipelines.customSchemaFile": ".vscode/dnceng-schema.json"
},
"extensions": [
"ms-dotnettools.csharp",
"EditorConfig.EditorConfig",
"ms-vscode.powershell",
"tintoy.msbuild-project-tools",
"ms-azure-devops.azure-pipelines"
],
"postCreateCommand": "${containerWorkspaceFolder}/restore.sh"
}
7 changes: 7 additions & 0 deletions .devcontainer/devinit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"run": [
{
"tool": "require-dotnetcoresdk"
}
]
}
1 change: 1 addition & 0 deletions .vscode/dnceng-schema.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-dotnettools.csharp",
"EditorConfig.EditorConfig",
"ms-vscode.powershell",
"tintoy.msbuild-project-tools",
"ms-azure-devops.azure-pipelines"
]
}
34 changes: 33 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
{
"files.associations": {
"**/eng/pipelines/*.yml": "azure-pipelines"
"*.csproj": "msbuild",
"*.fsproj": "msbuild",
"*.globalconfig": "ini",
"*.manifest": "xml",
"*.nuspec": "xml",
"*.pkgdef": "ini",
"*.projitems": "msbuild",
"*.props": "msbuild",
"*.resx": "xml",
"*.rsp": "Powershell",
"*.ruleset": "xml",
"*.settings": "xml",
"*.shproj": "msbuild",
"*.slnf": "json",
"*.targets": "msbuild",
"*.vbproj": "msbuild",
"*.vsixmanifest": "xml",
"*.vstemplate": "xml",
"*.xlf": "xml",
"*.yml": "azure-pipelines"
},
// ms-dotnettools.csharp settings
"omnisharp.defaultLaunchSolution": "Compilers.sln",
"omnisharp.disableMSBuildDiagnosticWarning": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableImportCompletion": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.useModernNet": true,
"omnisharp.enableAsyncCompletion": true,
// ms-vscode.powershell settings
"powershell.promptToUpdatePowerShell": false,
"powershell.integratedConsole.showOnStartup": false,
"powershell.startAutomatically": false,
// ms-azure-devops.azure-pipelines settings
"azure-pipelines.customSchemaFile": ".vscode/dnceng-schema.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ protected sealed override async Task FixAllAsync(Document document, ImmutableArr
{
#if CODE_STYLE
var provider = GetSyntaxFormattingService();
var options = SyntaxFormattingOptions.Create(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(editor.OriginalRoot.SyntaxTree, cancellationToken));
var options = provider.GetFormattingOptions(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(editor.OriginalRoot.SyntaxTree, cancellationToken));
#else
var provider = document.Project.Solution.Workspace.Services;
var options = await SyntaxFormattingOptions.FromDocumentAsync(document, cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ await FixOneAsync(

#if CODE_STYLE
var provider = GetSyntaxFormattingService();
var options = SyntaxFormattingOptions.Create(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken));
var options = provider.GetFormattingOptions(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken));
#else
var provider = document.Project.Solution.Workspace.Services;
var options = await SyntaxFormattingOptions.FromDocumentAsync(document, cancellationToken).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected sealed override void InitializeWorker(AnalysisContext context)

private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
{
var options = SyntaxFormattingOptions.Create(context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.Tree));
var options = SyntaxFormattingService.GetFormattingOptions(context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.Tree));
FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, SyntaxFormattingService, Descriptor, options);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ private async Task<Document> FixOneAsync(CodeFixContext context, Diagnostic diag
return context.Document.WithText(await updatedTree.GetTextAsync(cancellationToken).ConfigureAwait(false));
}

private static async Task<SyntaxFormattingOptions> GetOptionsAsync(Document document, CancellationToken cancellationToken)
private async Task<SyntaxFormattingOptions> GetOptionsAsync(Document document, CancellationToken cancellationToken)
{
var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree);

return SyntaxFormattingOptions.Create(analyzerConfigOptions);
return SyntaxFormattingService.GetFormattingOptions(analyzerConfigOptions);
}

public sealed override FixAllProvider GetFixAllProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Compile Include="..\..\..\Workspaces\VisualBasic\Portable\Formatting\Rules\NodeBasedFormattingRule.vb" Link="Formatting\Rules\NodeBasedFormattingRule.vb" />
<Compile Include="..\..\..\Workspaces\VisualBasic\Portable\Formatting\Rules\StructuredTriviaFormattingRule.vb" Link="Formatting\Rules\StructuredTriviaFormattingRule.vb" />
<Compile Include="..\..\..\Workspaces\VisualBasic\Portable\Formatting\VisualBasicSyntaxFormattingService.vb" Link="Formatting\VisualBasicSyntaxFormattingService.vb" />
<Compile Include="..\..\..\Workspaces\VisualBasic\Portable\Formatting\VisualBasicSyntaxFormattingOptions.vb" Link="Formatting\VisualBasicSyntaxFormattingOptions.vb" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.CodeAnalysis.Shared.Extensions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ public override bool Equals(Diagnostic? obj)
Equals(_suppressionJustification, other._suppressionJustification);
}

public override bool Equals(object? obj) => obj is Diagnostic diagnostic && Equals(diagnostic);

public override int GetHashCode()
{
return Hash.Combine(_originalDiagnostic.GetHashCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public override bool Equals(Diagnostic? obj)
Equals(_programmaticSuppressionInfo, other._programmaticSuppressionInfo);
}

public override bool Equals(object? obj)
{
return this.Equals(obj as Diagnostic);
}

public override int GetHashCode()
{
return Hash.Combine(_originalUnsuppressedDiagnostic.GetHashCode(), _programmaticSuppressionInfo.GetHashCode());
Expand Down
3 changes: 2 additions & 1 deletion src/Compilers/Core/Portable/Diagnostic/Diagnostic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ public override string ToString()
return DiagnosticFormatter.Instance.Format(this, CultureInfo.CurrentUICulture);
}

public abstract override bool Equals(object? obj);
public sealed override bool Equals(object? obj)
=> obj is Diagnostic diagnostic && Equals(diagnostic);

public abstract override int GetHashCode();

Expand Down
5 changes: 0 additions & 5 deletions src/Compilers/Core/Portable/Diagnostic/DiagnosticWithInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ public override int GetHashCode()
return Hash.Combine(this.Location.GetHashCode(), this.Info.GetHashCode());
}

public override bool Equals(object? obj)
{
return Equals(obj as Diagnostic);
}

public override bool Equals(Diagnostic? obj)
{
if (ReferenceEquals(this, obj))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ public override bool Equals(Diagnostic? obj)
&& _warningLevel == other._warningLevel;
}

public override bool Equals(object? obj)
{
return this.Equals(obj as Diagnostic);
}

public override int GetHashCode()
{
return Hash.Combine(_descriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ public override string GetMessage(IFormatProvider? formatProvider = null)
return _original.GetMessage(formatProvider);
}

public override bool Equals(object? obj)
{
return _original.Equals(obj);
}

public override int GetHashCode()
{
return _original.GetHashCode();
Expand Down
1 change: 0 additions & 1 deletion src/Compilers/Core/Portable/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,6 @@ Microsoft.CodeAnalysis.XmlReferenceResolver
Microsoft.CodeAnalysis.XmlReferenceResolver.XmlReferenceResolver() -> void
override abstract Microsoft.CodeAnalysis.CompilationOptions.Equals(object? obj) -> bool
override abstract Microsoft.CodeAnalysis.CompilationOptions.GetHashCode() -> int
override abstract Microsoft.CodeAnalysis.Diagnostic.Equals(object? obj) -> bool
override abstract Microsoft.CodeAnalysis.Diagnostic.GetHashCode() -> int
override abstract Microsoft.CodeAnalysis.DocumentationProvider.Equals(object? obj) -> bool
override abstract Microsoft.CodeAnalysis.DocumentationProvider.GetHashCode() -> int
Expand Down
3 changes: 2 additions & 1 deletion src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

*REMOVED*override abstract Microsoft.CodeAnalysis.Diagnostic.Equals(object? obj) -> bool
Microsoft.CodeAnalysis.Compilation.GetTypesByMetadataName(string! fullyQualifiedMetadataName) -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.INamedTypeSymbol!>
Microsoft.CodeAnalysis.IOperation.ChildOperations.get -> Microsoft.CodeAnalysis.IOperation.OperationList
Microsoft.CodeAnalysis.IOperation.OperationList
Expand All @@ -25,5 +25,6 @@ Microsoft.CodeAnalysis.IOperation.OperationList.Reversed.Reversed() -> void
Microsoft.CodeAnalysis.IOperation.OperationList.Reversed.Count.get -> int
Microsoft.CodeAnalysis.IOperation.OperationList.Reversed.GetEnumerator() -> Microsoft.CodeAnalysis.IOperation.OperationList.Reversed.Enumerator
Microsoft.CodeAnalysis.IOperation.OperationList.Reversed.ToImmutableArray() -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.IOperation!>
override sealed Microsoft.CodeAnalysis.Diagnostic.Equals(object? obj) -> bool
*REMOVED*static Microsoft.CodeAnalysis.SyntaxNodeExtensions.ReplaceSyntax<TRoot>(this TRoot! root, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode!>! nodes, System.Func<Microsoft.CodeAnalysis.SyntaxNode!, Microsoft.CodeAnalysis.SyntaxNode!, Microsoft.CodeAnalysis.SyntaxNode!>! computeReplacementNode, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxToken>! tokens, System.Func<Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken>! computeReplacementToken, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxTrivia>! trivia, System.Func<Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia>! computeReplacementTrivia) -> TRoot!
static Microsoft.CodeAnalysis.SyntaxNodeExtensions.ReplaceSyntax<TRoot>(this TRoot! root, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode!>? nodes, System.Func<Microsoft.CodeAnalysis.SyntaxNode!, Microsoft.CodeAnalysis.SyntaxNode!, Microsoft.CodeAnalysis.SyntaxNode!>? computeReplacementNode, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxToken>? tokens, System.Func<Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken>? computeReplacementToken, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxTrivia>? trivia, System.Func<Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia>? computeReplacementTrivia) -> TRoot!
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.BraceCompletion;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
Expand Down Expand Up @@ -2193,7 +2194,7 @@ class Test

using var workspace = new AdhocWorkspace();

var options = SyntaxFormattingOptions.Default;
var options = CSharpSyntaxFormattingOptions.Default;

var formattedRoot = Formatter.Format(root, workspace.Services, options, CancellationToken.None);
var annotatedTrivia = formattedRoot.GetAnnotatedTrivia("marker");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Remote;

namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
[Export(typeof(UnitTestingGlobalOptions)), Shared]
internal sealed class UnitTestingGlobalOptions
{
private readonly IGlobalOptionService _globalOptions;

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public UnitTestingGlobalOptions(IGlobalOptionService globalOptions)
{
_globalOptions = globalOptions;
}

public bool IsServiceHubProcessCoreClr
=> _globalOptions.GetOption(RemoteHostOptions.OOPCoreClrFeatureFlag);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
<ProjectReference Include="..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
<ProjectReference Include="..\..\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj" />
<ProjectReference Include="..\..\Features\LanguageServer\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj" />
<ProjectReference Include="..\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj" />
Expand Down Expand Up @@ -106,6 +107,10 @@
<InternalsVisibleTo Include="Roslyn.Services.Editor.TypeScript.UnitTests" Key="$(TypeScriptKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35077" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" LoadsWithinVisualStudio="false" />
<RestrictedInternalsVisibleTo Include="Microsoft.VisualStudio.IntelliCode" Key="$(IntelliCodeKey)" Partner="IntelliCode" />
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.LiveUnitTesting.BuildManager" Partner="UnitTesting" Key="$(UnitTestingKey)" />
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.LiveUnitTesting.BuildManager.Core" Partner="UnitTesting" Key="$(UnitTestingKey)" />
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.UnitTesting.SourceBasedTestDiscovery" Partner="UnitTesting" Key="$(UnitTestingKey)" />
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.UnitTesting.SourceBasedTestDiscovery.Core" Partner="UnitTesting" Key="$(UnitTestingKey)" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="EditorFeaturesResources.resx" GenerateSource="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void Register(Workspace workspace)

private async Task AnalyzeAsync()
{
var workerBackOffTimeSpan = InternalSolutionCrawlerOptions.PreviewBackOffTimeSpan;
var workerBackOffTimeSpan = SolutionCrawlerTimeSpan.PreviewBackOff;
var incrementalAnalyzer = _owner._analyzerService.CreateIncrementalAnalyzer(_workspace);

var solution = _workspace.CurrentSolution;
Expand Down
Loading

0 comments on commit 69bc730

Please sign in to comment.