repo_name
stringclasses 6
values | pr_number
int64 512
78.9k
| pr_title
stringlengths 3
144
| pr_description
stringlengths 0
30.3k
| author
stringlengths 2
21
| date_created
timestamp[ns, tz=UTC] | date_merged
timestamp[ns, tz=UTC] | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 17
30.4k
| filepath
stringlengths 9
210
| before_content
stringlengths 0
112M
| after_content
stringlengths 0
112M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/Server/VBCSCompilerTests/AnalyzerConsistencyCheckerTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Microsoft.CodeAnalysis.CSharp;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
public class AnalyzerConsistencyCheckerTests : TestBase
{
private ICompilerServerLogger Logger { get; }
public AnalyzerConsistencyCheckerTests(ITestOutputHelper testOutputHelper)
{
Logger = new XunitCompilerServerLogger(testOutputHelper);
}
[Fact]
public void MissingReference()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void AllChecksPassed()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var betaDll = directory.CreateFile("Beta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Beta.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void DifferingMvids()
{
var directory = Temp.CreateDirectory();
// Load Beta.dll from the future Alpha.dll path to prime the assembly loader
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var assemblyLoader = new InMemoryAssemblyLoader();
var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path);
alphaDll.WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger);
Assert.False(result);
}
[Fact]
public void AssemblyLoadException()
{
var directory = Temp.CreateDirectory();
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented, Logger);
Assert.False(result);
}
[Fact]
public void NetstandardIgnored()
{
var directory = Temp.CreateDirectory();
const string name = "netstandardRef";
var comp = CSharpCompilation.Create(
name,
new[] { SyntaxFactory.ParseSyntaxTree(@"class C {}") },
references: new MetadataReference[] { MetadataReference.CreateFromImage(TestMetadata.ResourcesNetStandard20.netstandard) },
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, warningLevel: Diagnostic.MaxWarningLevel));
var compFile = directory.CreateFile(name);
comp.Emit(compFile.Path);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(name));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
private class InMemoryAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly Dictionary<string, Assembly> _assemblies = new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
{
Assembly assembly;
if (!_assemblies.TryGetValue(fullPath, out assembly))
{
var bytes = File.ReadAllBytes(fullPath);
assembly = Assembly.Load(bytes);
_assemblies[fullPath] = assembly;
}
return assembly;
}
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Microsoft.CodeAnalysis.CSharp;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
public class AnalyzerConsistencyCheckerTests : TestBase
{
private ICompilerServerLogger Logger { get; }
public AnalyzerConsistencyCheckerTests(ITestOutputHelper testOutputHelper)
{
Logger = new XunitCompilerServerLogger(testOutputHelper);
}
[Fact]
public void MissingReference()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void AllChecksPassed()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var betaDll = directory.CreateFile("Beta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Beta.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void DifferingMvids()
{
var directory = Temp.CreateDirectory();
// Load Beta.dll from the future Alpha.dll path to prime the assembly loader
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var assemblyLoader = new InMemoryAssemblyLoader();
var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path);
alphaDll.WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger);
Assert.False(result);
}
[Fact]
public void AssemblyLoadException()
{
var directory = Temp.CreateDirectory();
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented, Logger);
Assert.False(result);
}
[Fact]
public void NetstandardIgnored()
{
var directory = Temp.CreateDirectory();
const string name = "netstandardRef";
var comp = CSharpCompilation.Create(
name,
new[] { SyntaxFactory.ParseSyntaxTree(@"class C {}") },
references: new MetadataReference[] { MetadataReference.CreateFromImage(TestMetadata.ResourcesNetStandard20.netstandard) },
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, warningLevel: Diagnostic.MaxWarningLevel));
var compFile = directory.CreateFile(name);
comp.Emit(compFile.Path);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(name));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
private class InMemoryAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly Dictionary<string, Assembly> _assemblies = new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
{
Assembly assembly;
if (!_assemblies.TryGetValue(fullPath, out assembly))
{
var bytes = File.ReadAllBytes(fullPath);
assembly = Assembly.Load(bytes);
_assemblies[fullPath] = assembly;
}
return assembly;
}
}
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/VisualBasic/Portable/Symbols/SynthesizedSymbols/SynthesizedParameterSymbol.vb | ' 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.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Base (simplified) class for synthesized parameter symbols of methods that have been synthesized. E.g. the parameters of delegate methods
''' </summary>
Friend Class SynthesizedParameterSimpleSymbol
Inherits ParameterSymbol
Protected ReadOnly _container As MethodSymbol
Protected ReadOnly _type As TypeSymbol
Protected ReadOnly _ordinal As Integer
Protected ReadOnly _name As String
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, name As String)
Me._container = container
Me._type = type
Me._ordinal = ordinal
Me._name = name
End Sub
''' <summary>
''' Gets the containing symbol.
''' </summary>
Public NotOverridable Overrides ReadOnly Property ContainingSymbol As Symbol
Get
Return Me._container
End Get
End Property
''' <summary>
''' The list of custom modifiers, if any, associated with the parameter. Evaluate this property only if IsModified is true.
''' </summary>
Public Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
Public Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
''' <summary>
''' A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
''' </summary>
Friend Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Get
Return Nothing
End Get
End Property
''' <summary>
''' True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
''' </summary>
Public Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether this instance is by ref.
''' </summary>
''' <value>
''' <c>true</c> if this instance is by ref; otherwise, <c>false</c>.
''' </value>
Public Overrides ReadOnly Property IsByRef As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataIn As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataOut As Boolean
Get
Return False
End Get
End Property
Friend Shared Function IsMarshalAsAttributeApplicable(propertySetter As MethodSymbol) As Boolean
Debug.Assert(propertySetter.MethodKind = MethodKind.PropertySet)
Return propertySetter.ContainingType.IsInterface
End Function
Friend Overrides ReadOnly Property MarshallingInformation As MarshalPseudoCustomAttributeData
Get
' Dev11 uses marshalling data of a return type of the containing method for the Value parameter
' of an interface property setter.
Dim method = DirectCast(Me.ContainingSymbol, MethodSymbol)
If method.MethodKind = MethodKind.PropertySet AndAlso
IsMarshalAsAttributeApplicable(method) Then
Return DirectCast(method.AssociatedSymbol, SourcePropertySymbol).ReturnTypeMarshallingInformation
End If
Return Nothing
End Get
End Property
Friend Overrides ReadOnly Property IsExplicitByRef As Boolean
Get
Return IsByRef
End Get
End Property
Friend Overrides ReadOnly Property HasOptionCompare As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsIDispatchConstant As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsIUnknownConstant As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerLineNumber As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerMemberName As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerFilePath As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property CallerArgumentExpressionParameterIndex As Integer
Get
Return -1
End Get
End Property
''' <summary>
''' True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
''' </summary>
Public Overrides ReadOnly Property IsOptional As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether this instance is param array.
''' </summary>
''' <value>
''' <c>true</c> if this instance is param array; otherwise, <c>false</c>.
''' </value>
Public Overrides ReadOnly Property IsParamArray As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether the symbol was generated by the compiler
''' rather than declared explicitly.
''' </summary>
Public Overrides ReadOnly Property IsImplicitlyDeclared As Boolean
Get
Return True
End Get
End Property
''' <summary>
''' A potentially empty collection of locations that correspond to this instance.
''' </summary>
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return ImmutableArray(Of Location).Empty
End Get
End Property
Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
Return ImmutableArray(Of SyntaxReference).Empty
End Get
End Property
''' <summary>
''' Gets the ordinal.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Ordinal As Integer
Get
Return _ordinal
End Get
End Property
''' <summary>
''' Gets the type.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Type As TypeSymbol
Get
Return _type
End Get
End Property
''' <summary>
''' Gets the name.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Name As String
Get
Return _name
End Get
End Property
Friend NotOverridable Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
Dim compilation = Me.DeclaringCompilation
If Type.ContainsTupleNames() AndAlso
compilation.HasTupleNamesAttributes Then
AddSynthesizedAttribute(attributes, compilation.SynthesizeTupleNamesAttribute(Type))
End If
End Sub
End Class
''' <summary>
''' Base class for synthesized parameter symbols of methods that have been synthesized. E.g. the parameters of delegate methods
''' </summary>
Friend Class SynthesizedParameterSymbol
Inherits SynthesizedParameterSimpleSymbol
Private ReadOnly _isByRef As Boolean
Private ReadOnly _isOptional As Boolean
Private ReadOnly _defaultValue As ConstantValue
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, Optional name As String = "")
Me.New(container, type, ordinal, isByRef, name, False, Nothing)
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String, isOptional As Boolean, defaultValue As ConstantValue)
MyBase.New(container, type, ordinal, name)
Me._isByRef = isByRef
Me._isOptional = isOptional
Me._defaultValue = defaultValue
End Sub
Public Shared Function Create(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String,
customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier)
) As SynthesizedParameterSymbol
If customModifiers.IsEmpty AndAlso refCustomModifiers.IsEmpty Then
Return New SynthesizedParameterSymbol(container, type, ordinal, isByRef, name, isOptional:=False, defaultValue:=Nothing)
End If
Return New SynthesizedParameterSymbolWithCustomModifiers(container, type, ordinal, isByRef, name, customModifiers, refCustomModifiers)
End Function
Friend Shared Function CreateSetAccessorValueParameter(setter As MethodSymbol, propertySymbol As PropertySymbol, parameterName As String) As ParameterSymbol
Dim valueParameterType As TypeSymbol = propertySymbol.Type
Dim valueParameterCustomModifiers = propertySymbol.TypeCustomModifiers
Dim overriddenMethod = setter.OverriddenMethod
If overriddenMethod IsNot Nothing Then
Dim overriddenParameter = overriddenMethod.Parameters(propertySymbol.ParameterCount)
If overriddenParameter.Type.IsSameTypeIgnoringAll(valueParameterType) Then
valueParameterType = overriddenParameter.Type
valueParameterCustomModifiers = overriddenParameter.CustomModifiers
End If
End If
If valueParameterCustomModifiers.IsEmpty Then
Return New SynthesizedParameterSimpleSymbol(setter,
valueParameterType,
propertySymbol.ParameterCount,
parameterName)
End If
Return New SynthesizedParameterSymbolWithCustomModifiers(setter,
valueParameterType,
propertySymbol.ParameterCount,
False,
parameterName,
valueParameterCustomModifiers,
ImmutableArray(Of CustomModifier).Empty) ' Never ByRef
End Function
''' <summary>
''' Gets a value indicating whether this instance is by ref.
''' </summary>
''' <value>
''' <c>true</c> if this instance is by ref; otherwise, <c>false</c>.
''' </value>
Public NotOverridable Overrides ReadOnly Property IsByRef As Boolean
Get
Return _isByRef
End Get
End Property
''' <summary>
''' True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
''' </summary>
Public NotOverridable Overrides ReadOnly Property IsOptional As Boolean
Get
Return _isOptional
End Get
End Property
''' <summary>
''' A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
''' </summary>
Friend NotOverridable Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Get
Return _defaultValue
End Get
End Property
''' <summary>
''' True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
''' </summary>
Public NotOverridable Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
Get
Return _defaultValue IsNot Nothing
End Get
End Property
End Class
Friend Class SynthesizedParameterSymbolWithCustomModifiers
Inherits SynthesizedParameterSymbol
Private ReadOnly _customModifiers As ImmutableArray(Of CustomModifier)
Private ReadOnly _refCustomModifiers As ImmutableArray(Of CustomModifier)
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbolWithCustomModifiers" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
''' <param name="customModifiers">The custom modifiers of this parameter type</param>
''' <param name="refCustomModifiers">The custom modifiers of ref modifier</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String,
customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier))
MyBase.New(container, type, ordinal, isByRef, name, isOptional:=False, defaultValue:=Nothing)
Debug.Assert(Not customModifiers.IsEmpty OrElse Not refCustomModifiers.IsEmpty)
Me._customModifiers = customModifiers
Me._refCustomModifiers = refCustomModifiers
Debug.Assert(Me._refCustomModifiers.IsEmpty OrElse Me.IsByRef)
End Sub
''' <summary>
''' The list of custom modifiers, if any, associated with the parameter. Evaluate this property only if IsModified is true.
''' </summary>
Public NotOverridable Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return Me._customModifiers
End Get
End Property
Public NotOverridable Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return Me._refCustomModifiers
End Get
End Property
End Class
''' <summary>
''' Extends SynthesizedParameterSymbol to also accept a location
''' </summary>
Friend NotInheritable Class SynthesizedParameterWithLocationSymbol
Inherits SynthesizedParameterSymbol
Private ReadOnly _locations As ImmutableArray(Of Location)
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String, location As Location)
MyBase.New(container, type, ordinal, isByRef, name)
Me._locations = ImmutableArray.Create(Of location)(location)
End Sub
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return Me._locations
End Get
End Property
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Base (simplified) class for synthesized parameter symbols of methods that have been synthesized. E.g. the parameters of delegate methods
''' </summary>
Friend Class SynthesizedParameterSimpleSymbol
Inherits ParameterSymbol
Protected ReadOnly _container As MethodSymbol
Protected ReadOnly _type As TypeSymbol
Protected ReadOnly _ordinal As Integer
Protected ReadOnly _name As String
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, name As String)
Me._container = container
Me._type = type
Me._ordinal = ordinal
Me._name = name
End Sub
''' <summary>
''' Gets the containing symbol.
''' </summary>
Public NotOverridable Overrides ReadOnly Property ContainingSymbol As Symbol
Get
Return Me._container
End Get
End Property
''' <summary>
''' The list of custom modifiers, if any, associated with the parameter. Evaluate this property only if IsModified is true.
''' </summary>
Public Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
Public Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
''' <summary>
''' A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
''' </summary>
Friend Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Get
Return Nothing
End Get
End Property
''' <summary>
''' True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
''' </summary>
Public Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether this instance is by ref.
''' </summary>
''' <value>
''' <c>true</c> if this instance is by ref; otherwise, <c>false</c>.
''' </value>
Public Overrides ReadOnly Property IsByRef As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataIn As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataOut As Boolean
Get
Return False
End Get
End Property
Friend Shared Function IsMarshalAsAttributeApplicable(propertySetter As MethodSymbol) As Boolean
Debug.Assert(propertySetter.MethodKind = MethodKind.PropertySet)
Return propertySetter.ContainingType.IsInterface
End Function
Friend Overrides ReadOnly Property MarshallingInformation As MarshalPseudoCustomAttributeData
Get
' Dev11 uses marshalling data of a return type of the containing method for the Value parameter
' of an interface property setter.
Dim method = DirectCast(Me.ContainingSymbol, MethodSymbol)
If method.MethodKind = MethodKind.PropertySet AndAlso
IsMarshalAsAttributeApplicable(method) Then
Return DirectCast(method.AssociatedSymbol, SourcePropertySymbol).ReturnTypeMarshallingInformation
End If
Return Nothing
End Get
End Property
Friend Overrides ReadOnly Property IsExplicitByRef As Boolean
Get
Return IsByRef
End Get
End Property
Friend Overrides ReadOnly Property HasOptionCompare As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsIDispatchConstant As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsIUnknownConstant As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerLineNumber As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerMemberName As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property IsCallerFilePath As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property CallerArgumentExpressionParameterIndex As Integer
Get
Return -1
End Get
End Property
''' <summary>
''' True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
''' </summary>
Public Overrides ReadOnly Property IsOptional As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether this instance is param array.
''' </summary>
''' <value>
''' <c>true</c> if this instance is param array; otherwise, <c>false</c>.
''' </value>
Public Overrides ReadOnly Property IsParamArray As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets a value indicating whether the symbol was generated by the compiler
''' rather than declared explicitly.
''' </summary>
Public Overrides ReadOnly Property IsImplicitlyDeclared As Boolean
Get
Return True
End Get
End Property
''' <summary>
''' A potentially empty collection of locations that correspond to this instance.
''' </summary>
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return ImmutableArray(Of Location).Empty
End Get
End Property
Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
Return ImmutableArray(Of SyntaxReference).Empty
End Get
End Property
''' <summary>
''' Gets the ordinal.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Ordinal As Integer
Get
Return _ordinal
End Get
End Property
''' <summary>
''' Gets the type.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Type As TypeSymbol
Get
Return _type
End Get
End Property
''' <summary>
''' Gets the name.
''' </summary>
Public NotOverridable Overrides ReadOnly Property Name As String
Get
Return _name
End Get
End Property
Friend NotOverridable Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
Dim compilation = Me.DeclaringCompilation
If Type.ContainsTupleNames() AndAlso
compilation.HasTupleNamesAttributes Then
AddSynthesizedAttribute(attributes, compilation.SynthesizeTupleNamesAttribute(Type))
End If
End Sub
End Class
''' <summary>
''' Base class for synthesized parameter symbols of methods that have been synthesized. E.g. the parameters of delegate methods
''' </summary>
Friend Class SynthesizedParameterSymbol
Inherits SynthesizedParameterSimpleSymbol
Private ReadOnly _isByRef As Boolean
Private ReadOnly _isOptional As Boolean
Private ReadOnly _defaultValue As ConstantValue
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, Optional name As String = "")
Me.New(container, type, ordinal, isByRef, name, False, Nothing)
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbol" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String, isOptional As Boolean, defaultValue As ConstantValue)
MyBase.New(container, type, ordinal, name)
Me._isByRef = isByRef
Me._isOptional = isOptional
Me._defaultValue = defaultValue
End Sub
Public Shared Function Create(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String,
customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier)
) As SynthesizedParameterSymbol
If customModifiers.IsEmpty AndAlso refCustomModifiers.IsEmpty Then
Return New SynthesizedParameterSymbol(container, type, ordinal, isByRef, name, isOptional:=False, defaultValue:=Nothing)
End If
Return New SynthesizedParameterSymbolWithCustomModifiers(container, type, ordinal, isByRef, name, customModifiers, refCustomModifiers)
End Function
Friend Shared Function CreateSetAccessorValueParameter(setter As MethodSymbol, propertySymbol As PropertySymbol, parameterName As String) As ParameterSymbol
Dim valueParameterType As TypeSymbol = propertySymbol.Type
Dim valueParameterCustomModifiers = propertySymbol.TypeCustomModifiers
Dim overriddenMethod = setter.OverriddenMethod
If overriddenMethod IsNot Nothing Then
Dim overriddenParameter = overriddenMethod.Parameters(propertySymbol.ParameterCount)
If overriddenParameter.Type.IsSameTypeIgnoringAll(valueParameterType) Then
valueParameterType = overriddenParameter.Type
valueParameterCustomModifiers = overriddenParameter.CustomModifiers
End If
End If
If valueParameterCustomModifiers.IsEmpty Then
Return New SynthesizedParameterSimpleSymbol(setter,
valueParameterType,
propertySymbol.ParameterCount,
parameterName)
End If
Return New SynthesizedParameterSymbolWithCustomModifiers(setter,
valueParameterType,
propertySymbol.ParameterCount,
False,
parameterName,
valueParameterCustomModifiers,
ImmutableArray(Of CustomModifier).Empty) ' Never ByRef
End Function
''' <summary>
''' Gets a value indicating whether this instance is by ref.
''' </summary>
''' <value>
''' <c>true</c> if this instance is by ref; otherwise, <c>false</c>.
''' </value>
Public NotOverridable Overrides ReadOnly Property IsByRef As Boolean
Get
Return _isByRef
End Get
End Property
''' <summary>
''' True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
''' </summary>
Public NotOverridable Overrides ReadOnly Property IsOptional As Boolean
Get
Return _isOptional
End Get
End Property
''' <summary>
''' A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
''' </summary>
Friend NotOverridable Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Get
Return _defaultValue
End Get
End Property
''' <summary>
''' True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
''' </summary>
Public NotOverridable Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
Get
Return _defaultValue IsNot Nothing
End Get
End Property
End Class
Friend Class SynthesizedParameterSymbolWithCustomModifiers
Inherits SynthesizedParameterSymbol
Private ReadOnly _customModifiers As ImmutableArray(Of CustomModifier)
Private ReadOnly _refCustomModifiers As ImmutableArray(Of CustomModifier)
''' <summary>
''' Initializes a new instance of the <see cref="SynthesizedParameterSymbolWithCustomModifiers" /> class.
''' </summary>
''' <param name="container">The containing symbol</param>
''' <param name="type">The type of this parameter</param>
''' <param name="ordinal">The ordinal number of this parameter</param>
''' <param name="isByRef">Whether the parameter is ByRef or not</param>
''' <param name="name">The name of this parameter</param>
''' <param name="customModifiers">The custom modifiers of this parameter type</param>
''' <param name="refCustomModifiers">The custom modifiers of ref modifier</param>
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String,
customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier))
MyBase.New(container, type, ordinal, isByRef, name, isOptional:=False, defaultValue:=Nothing)
Debug.Assert(Not customModifiers.IsEmpty OrElse Not refCustomModifiers.IsEmpty)
Me._customModifiers = customModifiers
Me._refCustomModifiers = refCustomModifiers
Debug.Assert(Me._refCustomModifiers.IsEmpty OrElse Me.IsByRef)
End Sub
''' <summary>
''' The list of custom modifiers, if any, associated with the parameter. Evaluate this property only if IsModified is true.
''' </summary>
Public NotOverridable Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return Me._customModifiers
End Get
End Property
Public NotOverridable Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return Me._refCustomModifiers
End Get
End Property
End Class
''' <summary>
''' Extends SynthesizedParameterSymbol to also accept a location
''' </summary>
Friend NotInheritable Class SynthesizedParameterWithLocationSymbol
Inherits SynthesizedParameterSymbol
Private ReadOnly _locations As ImmutableArray(Of Location)
Public Sub New(container As MethodSymbol, type As TypeSymbol, ordinal As Integer, isByRef As Boolean, name As String, location As Location)
MyBase.New(container, type, ordinal, isByRef, name)
Me._locations = ImmutableArray.Create(Of location)(location)
End Sub
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return Me._locations
End Get
End Property
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Statements/CatchKeywordRecommender.vb | ' 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.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Statements
''' <summary>
''' Recommends the "Catch" keyword for the statement context
''' </summary>
Friend Class CatchKeywordRecommender
Inherits AbstractKeywordRecommender
Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
ImmutableArray.Create(New RecommendedKeyword("Catch", VBFeaturesResources.Introduces_a_statement_block_to_be_run_if_the_specified_exception_occurs_inside_a_Try_block))
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
If Not context.IsMultiLineStatementContext Then
Return ImmutableArray(Of RecommendedKeyword).Empty
End If
' We'll recommend a catch statement if it's within a Try block or a Catch block, because you could be
' trying to start one in either location
Return If(context.IsInStatementBlockOfKind(SyntaxKind.TryBlock, SyntaxKind.CatchBlock) AndAlso Not context.IsInStatementBlockOfKind(SyntaxKind.FinallyBlock),
s_keywords,
ImmutableArray(Of RecommendedKeyword).Empty)
End Function
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Statements
''' <summary>
''' Recommends the "Catch" keyword for the statement context
''' </summary>
Friend Class CatchKeywordRecommender
Inherits AbstractKeywordRecommender
Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
ImmutableArray.Create(New RecommendedKeyword("Catch", VBFeaturesResources.Introduces_a_statement_block_to_be_run_if_the_specified_exception_occurs_inside_a_Try_block))
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
If Not context.IsMultiLineStatementContext Then
Return ImmutableArray(Of RecommendedKeyword).Empty
End If
' We'll recommend a catch statement if it's within a Try block or a Catch block, because you could be
' trying to start one in either location
Return If(context.IsInStatementBlockOfKind(SyntaxKind.TryBlock, SyntaxKind.CatchBlock) AndAlso Not context.IsInStatementBlockOfKind(SyntaxKind.FinallyBlock),
s_keywords,
ImmutableArray(Of RecommendedKeyword).Empty)
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/FlowAnalysis/SymbolUsageAnalysis/SymbolUsageAnalysis.DataFlowAnalyzer.cs | // 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.
#nullable disable
using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.FlowAnalysis.SymbolUsageAnalysis
{
internal static partial class SymbolUsageAnalysis
{
/// <summary>
/// Dataflow analysis to compute symbol usage information (i.e. reads/writes) for locals/parameters
/// in a given control flow graph, along with the information of whether or not the writes
/// may be read on some control flow path.
/// </summary>
private sealed partial class DataFlowAnalyzer : DataFlowAnalyzer<BasicBlockAnalysisData>
{
private readonly FlowGraphAnalysisData _analysisData;
private DataFlowAnalyzer(ControlFlowGraph cfg, ISymbol owningSymbol)
=> _analysisData = FlowGraphAnalysisData.Create(cfg, owningSymbol, AnalyzeLocalFunctionOrLambdaInvocation);
private DataFlowAnalyzer(
ControlFlowGraph cfg,
IMethodSymbol lambdaOrLocalFunction,
FlowGraphAnalysisData parentAnalysisData)
{
_analysisData = FlowGraphAnalysisData.Create(cfg, lambdaOrLocalFunction, parentAnalysisData);
var entryBlockAnalysisData = GetEmptyAnalysisData();
entryBlockAnalysisData.SetAnalysisDataFrom(parentAnalysisData.CurrentBlockAnalysisData);
_analysisData.SetBlockAnalysisData(cfg.EntryBlock(), entryBlockAnalysisData);
}
public static SymbolUsageResult RunAnalysis(ControlFlowGraph cfg, ISymbol owningSymbol, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
using var analyzer = new DataFlowAnalyzer(cfg, owningSymbol);
_ = CustomDataFlowAnalysis<BasicBlockAnalysisData>.Run(cfg, analyzer, cancellationToken);
return analyzer._analysisData.ToResult();
}
public override void Dispose()
=> _analysisData.Dispose();
private static BasicBlockAnalysisData AnalyzeLocalFunctionOrLambdaInvocation(
IMethodSymbol localFunctionOrLambda,
ControlFlowGraph cfg,
AnalysisData parentAnalysisData,
CancellationToken cancellationToken)
{
Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
cancellationToken.ThrowIfCancellationRequested();
using var analyzer = new DataFlowAnalyzer(cfg, localFunctionOrLambda, (FlowGraphAnalysisData)parentAnalysisData);
var resultBlockAnalysisData = CustomDataFlowAnalysis<BasicBlockAnalysisData>.Run(cfg, analyzer, cancellationToken);
if (resultBlockAnalysisData == null)
{
// Unreachable exit block from lambda/local.
// So use our current analysis data.
return parentAnalysisData.CurrentBlockAnalysisData;
}
// We need to return a cloned basic block analysis data as disposing the DataFlowAnalyzer
// created above will dispose all basic block analysis data instances allocated by it.
var clonedBasicBlockData = parentAnalysisData.CreateBlockAnalysisData();
clonedBasicBlockData.SetAnalysisDataFrom(resultBlockAnalysisData);
return clonedBasicBlockData;
}
// Don't analyze blocks which are unreachable, as any write
// in such a block which has a read outside will be marked redundant, which will just be noise for users.
// For example,
// int x;
// if (true)
// x = 0;
// else
// x = 1; // This will be marked redundant if "AnalyzeUnreachableBlocks = true"
// return x;
public override bool AnalyzeUnreachableBlocks => false;
public override BasicBlockAnalysisData AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
{
BeforeBlockAnalysis();
Walker.AnalyzeOperationsAndUpdateData(_analysisData.OwningSymbol, basicBlock.Operations, _analysisData, cancellationToken);
AfterBlockAnalysis();
return _analysisData.CurrentBlockAnalysisData;
// Local functions.
void BeforeBlockAnalysis()
{
// Initialize current block analysis data.
_analysisData.SetCurrentBlockAnalysisDataFrom(basicBlock, cancellationToken);
// At start of entry block, handle parameter definitions from method declaration.
if (basicBlock.Kind == BasicBlockKind.Entry)
{
_analysisData.SetAnalysisDataOnEntryBlockStart();
}
}
void AfterBlockAnalysis()
{
// If we are exiting the control flow graph, handle ref/out parameter definitions from method declaration.
if (basicBlock.FallThroughSuccessor?.Destination == null &&
basicBlock.ConditionalSuccessor?.Destination == null)
{
_analysisData.SetAnalysisDataOnMethodExit();
}
}
}
public override BasicBlockAnalysisData AnalyzeNonConditionalBranch(
BasicBlock basicBlock,
BasicBlockAnalysisData currentBlockAnalysisData,
CancellationToken cancellationToken)
=> AnalyzeBranch(basicBlock.FallThroughSuccessor, basicBlock, currentBlockAnalysisData, cancellationToken);
public override (BasicBlockAnalysisData fallThroughSuccessorData, BasicBlockAnalysisData conditionalSuccessorData) AnalyzeConditionalBranch(
BasicBlock basicBlock,
BasicBlockAnalysisData currentAnalysisData,
CancellationToken cancellationToken)
{
// Ensure that we use distinct input BasicBlockAnalysisData instances with identical analysis data for both AnalyzeBranch invocations.
using var savedCurrentAnalysisData = BasicBlockAnalysisData.GetInstance();
savedCurrentAnalysisData.SetAnalysisDataFrom(currentAnalysisData);
var newCurrentAnalysisData = AnalyzeBranch(basicBlock.FallThroughSuccessor, basicBlock, currentAnalysisData, cancellationToken);
// Ensure that we use different instances of block analysis data for fall through successor and conditional successor.
_analysisData.AdditionalConditionalBranchAnalysisData.SetAnalysisDataFrom(newCurrentAnalysisData);
var fallThroughSuccessorData = _analysisData.AdditionalConditionalBranchAnalysisData;
var conditionalSuccessorData = AnalyzeBranch(basicBlock.ConditionalSuccessor, basicBlock, savedCurrentAnalysisData, cancellationToken);
return (fallThroughSuccessorData, conditionalSuccessorData);
}
private BasicBlockAnalysisData AnalyzeBranch(
ControlFlowBranch branch,
BasicBlock basicBlock,
BasicBlockAnalysisData currentBlockAnalysisData,
CancellationToken cancellationToken)
{
// Initialize current analysis data
_analysisData.SetCurrentBlockAnalysisDataFrom(currentBlockAnalysisData);
// Analyze the branch value
var operations = SpecializedCollections.SingletonEnumerable(basicBlock.BranchValue);
Walker.AnalyzeOperationsAndUpdateData(_analysisData.OwningSymbol, operations, _analysisData, cancellationToken);
ProcessOutOfScopeLocals();
return _analysisData.CurrentBlockAnalysisData;
// Local functions
void ProcessOutOfScopeLocals()
{
if (branch == null)
{
return;
}
if (basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Catch &&
!branch.FinallyRegions.IsEmpty)
{
// Bail out for branches from the catch block
// as the locals are still accessible in the finally region.
return;
}
foreach (var region in branch.LeavingRegions)
{
foreach (var local in region.Locals)
{
_analysisData.CurrentBlockAnalysisData.Clear(local);
}
if (region.Kind == ControlFlowRegionKind.TryAndFinally)
{
// Locals defined in the outer regions of try/finally might be used in finally region.
break;
}
}
}
}
public override BasicBlockAnalysisData GetCurrentAnalysisData(BasicBlock basicBlock)
=> _analysisData.GetBlockAnalysisData(basicBlock) ?? GetEmptyAnalysisData();
public override BasicBlockAnalysisData GetEmptyAnalysisData()
=> _analysisData.CreateBlockAnalysisData();
public override void SetCurrentAnalysisData(BasicBlock basicBlock, BasicBlockAnalysisData data, CancellationToken cancellationToken)
=> _analysisData.SetBlockAnalysisDataFrom(basicBlock, data, cancellationToken);
public override bool IsEqual(BasicBlockAnalysisData analysisData1, BasicBlockAnalysisData analysisData2)
=> analysisData1 == null ? analysisData2 == null : analysisData1.Equals(analysisData2);
public override BasicBlockAnalysisData Merge(
BasicBlockAnalysisData analysisData1,
BasicBlockAnalysisData analysisData2,
CancellationToken cancellationToken)
=> BasicBlockAnalysisData.Merge(analysisData1, analysisData2, _analysisData.TrackAllocatedBlockAnalysisData);
}
}
}
| // 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.
#nullable disable
using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.FlowAnalysis.SymbolUsageAnalysis
{
internal static partial class SymbolUsageAnalysis
{
/// <summary>
/// Dataflow analysis to compute symbol usage information (i.e. reads/writes) for locals/parameters
/// in a given control flow graph, along with the information of whether or not the writes
/// may be read on some control flow path.
/// </summary>
private sealed partial class DataFlowAnalyzer : DataFlowAnalyzer<BasicBlockAnalysisData>
{
private readonly FlowGraphAnalysisData _analysisData;
private DataFlowAnalyzer(ControlFlowGraph cfg, ISymbol owningSymbol)
=> _analysisData = FlowGraphAnalysisData.Create(cfg, owningSymbol, AnalyzeLocalFunctionOrLambdaInvocation);
private DataFlowAnalyzer(
ControlFlowGraph cfg,
IMethodSymbol lambdaOrLocalFunction,
FlowGraphAnalysisData parentAnalysisData)
{
_analysisData = FlowGraphAnalysisData.Create(cfg, lambdaOrLocalFunction, parentAnalysisData);
var entryBlockAnalysisData = GetEmptyAnalysisData();
entryBlockAnalysisData.SetAnalysisDataFrom(parentAnalysisData.CurrentBlockAnalysisData);
_analysisData.SetBlockAnalysisData(cfg.EntryBlock(), entryBlockAnalysisData);
}
public static SymbolUsageResult RunAnalysis(ControlFlowGraph cfg, ISymbol owningSymbol, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
using var analyzer = new DataFlowAnalyzer(cfg, owningSymbol);
_ = CustomDataFlowAnalysis<BasicBlockAnalysisData>.Run(cfg, analyzer, cancellationToken);
return analyzer._analysisData.ToResult();
}
public override void Dispose()
=> _analysisData.Dispose();
private static BasicBlockAnalysisData AnalyzeLocalFunctionOrLambdaInvocation(
IMethodSymbol localFunctionOrLambda,
ControlFlowGraph cfg,
AnalysisData parentAnalysisData,
CancellationToken cancellationToken)
{
Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
cancellationToken.ThrowIfCancellationRequested();
using var analyzer = new DataFlowAnalyzer(cfg, localFunctionOrLambda, (FlowGraphAnalysisData)parentAnalysisData);
var resultBlockAnalysisData = CustomDataFlowAnalysis<BasicBlockAnalysisData>.Run(cfg, analyzer, cancellationToken);
if (resultBlockAnalysisData == null)
{
// Unreachable exit block from lambda/local.
// So use our current analysis data.
return parentAnalysisData.CurrentBlockAnalysisData;
}
// We need to return a cloned basic block analysis data as disposing the DataFlowAnalyzer
// created above will dispose all basic block analysis data instances allocated by it.
var clonedBasicBlockData = parentAnalysisData.CreateBlockAnalysisData();
clonedBasicBlockData.SetAnalysisDataFrom(resultBlockAnalysisData);
return clonedBasicBlockData;
}
// Don't analyze blocks which are unreachable, as any write
// in such a block which has a read outside will be marked redundant, which will just be noise for users.
// For example,
// int x;
// if (true)
// x = 0;
// else
// x = 1; // This will be marked redundant if "AnalyzeUnreachableBlocks = true"
// return x;
public override bool AnalyzeUnreachableBlocks => false;
public override BasicBlockAnalysisData AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
{
BeforeBlockAnalysis();
Walker.AnalyzeOperationsAndUpdateData(_analysisData.OwningSymbol, basicBlock.Operations, _analysisData, cancellationToken);
AfterBlockAnalysis();
return _analysisData.CurrentBlockAnalysisData;
// Local functions.
void BeforeBlockAnalysis()
{
// Initialize current block analysis data.
_analysisData.SetCurrentBlockAnalysisDataFrom(basicBlock, cancellationToken);
// At start of entry block, handle parameter definitions from method declaration.
if (basicBlock.Kind == BasicBlockKind.Entry)
{
_analysisData.SetAnalysisDataOnEntryBlockStart();
}
}
void AfterBlockAnalysis()
{
// If we are exiting the control flow graph, handle ref/out parameter definitions from method declaration.
if (basicBlock.FallThroughSuccessor?.Destination == null &&
basicBlock.ConditionalSuccessor?.Destination == null)
{
_analysisData.SetAnalysisDataOnMethodExit();
}
}
}
public override BasicBlockAnalysisData AnalyzeNonConditionalBranch(
BasicBlock basicBlock,
BasicBlockAnalysisData currentBlockAnalysisData,
CancellationToken cancellationToken)
=> AnalyzeBranch(basicBlock.FallThroughSuccessor, basicBlock, currentBlockAnalysisData, cancellationToken);
public override (BasicBlockAnalysisData fallThroughSuccessorData, BasicBlockAnalysisData conditionalSuccessorData) AnalyzeConditionalBranch(
BasicBlock basicBlock,
BasicBlockAnalysisData currentAnalysisData,
CancellationToken cancellationToken)
{
// Ensure that we use distinct input BasicBlockAnalysisData instances with identical analysis data for both AnalyzeBranch invocations.
using var savedCurrentAnalysisData = BasicBlockAnalysisData.GetInstance();
savedCurrentAnalysisData.SetAnalysisDataFrom(currentAnalysisData);
var newCurrentAnalysisData = AnalyzeBranch(basicBlock.FallThroughSuccessor, basicBlock, currentAnalysisData, cancellationToken);
// Ensure that we use different instances of block analysis data for fall through successor and conditional successor.
_analysisData.AdditionalConditionalBranchAnalysisData.SetAnalysisDataFrom(newCurrentAnalysisData);
var fallThroughSuccessorData = _analysisData.AdditionalConditionalBranchAnalysisData;
var conditionalSuccessorData = AnalyzeBranch(basicBlock.ConditionalSuccessor, basicBlock, savedCurrentAnalysisData, cancellationToken);
return (fallThroughSuccessorData, conditionalSuccessorData);
}
private BasicBlockAnalysisData AnalyzeBranch(
ControlFlowBranch branch,
BasicBlock basicBlock,
BasicBlockAnalysisData currentBlockAnalysisData,
CancellationToken cancellationToken)
{
// Initialize current analysis data
_analysisData.SetCurrentBlockAnalysisDataFrom(currentBlockAnalysisData);
// Analyze the branch value
var operations = SpecializedCollections.SingletonEnumerable(basicBlock.BranchValue);
Walker.AnalyzeOperationsAndUpdateData(_analysisData.OwningSymbol, operations, _analysisData, cancellationToken);
ProcessOutOfScopeLocals();
return _analysisData.CurrentBlockAnalysisData;
// Local functions
void ProcessOutOfScopeLocals()
{
if (branch == null)
{
return;
}
if (basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Catch &&
!branch.FinallyRegions.IsEmpty)
{
// Bail out for branches from the catch block
// as the locals are still accessible in the finally region.
return;
}
foreach (var region in branch.LeavingRegions)
{
foreach (var local in region.Locals)
{
_analysisData.CurrentBlockAnalysisData.Clear(local);
}
if (region.Kind == ControlFlowRegionKind.TryAndFinally)
{
// Locals defined in the outer regions of try/finally might be used in finally region.
break;
}
}
}
}
public override BasicBlockAnalysisData GetCurrentAnalysisData(BasicBlock basicBlock)
=> _analysisData.GetBlockAnalysisData(basicBlock) ?? GetEmptyAnalysisData();
public override BasicBlockAnalysisData GetEmptyAnalysisData()
=> _analysisData.CreateBlockAnalysisData();
public override void SetCurrentAnalysisData(BasicBlock basicBlock, BasicBlockAnalysisData data, CancellationToken cancellationToken)
=> _analysisData.SetBlockAnalysisDataFrom(basicBlock, data, cancellationToken);
public override bool IsEqual(BasicBlockAnalysisData analysisData1, BasicBlockAnalysisData analysisData2)
=> analysisData1 == null ? analysisData2 == null : analysisData1.Equals(analysisData2);
public override BasicBlockAnalysisData Merge(
BasicBlockAnalysisData analysisData1,
BasicBlockAnalysisData analysisData2,
CancellationToken cancellationToken)
=> BasicBlockAnalysisData.Merge(analysisData1, analysisData2, _analysisData.TrackAllocatedBlockAnalysisData);
}
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/Core/Portable/Classification/ISemanticClassificationCacheService.cs | // 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.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PersistentStorage;
using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Classification
{
/// <summary>
/// Service that can retrieve semantic classifications for a document cached during a previous session. This is
/// intended to help populate semantic classifications for a host during the time while a solution is loading and
/// semantics may be incomplete or unavailable.
/// </summary>
internal interface ISemanticClassificationCacheService : IWorkspaceService
{
/// <summary>
/// Tries to get cached semantic classifications for the specified document and the specified <paramref
/// name="textSpan"/>. Will return a <c>default</c> array not able to. An empty array indicates that there
/// were cached classifications, but none that intersected the provided <paramref name="textSpan"/>.
/// </summary>
/// <param name="checksum">Pass in <see cref="DocumentStateChecksums.Text"/>. This will ensure that the cached
/// classifications are only returned if they match the content the file currently has.</param>
Task<ImmutableArray<ClassifiedSpan>> GetCachedSemanticClassificationsAsync(
DocumentKey documentKey, TextSpan textSpan, Checksum checksum, CancellationToken cancellationToken);
}
[ExportWorkspaceService(typeof(ISemanticClassificationCacheService)), Shared]
internal class DefaultSemanticClassificationCacheService : ISemanticClassificationCacheService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultSemanticClassificationCacheService()
{
}
public Task<ImmutableArray<ClassifiedSpan>> GetCachedSemanticClassificationsAsync(DocumentKey documentKey, TextSpan textSpan, Checksum checksum, CancellationToken cancellationToken)
=> SpecializedTasks.Default<ImmutableArray<ClassifiedSpan>>();
}
}
| // 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.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PersistentStorage;
using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Classification
{
/// <summary>
/// Service that can retrieve semantic classifications for a document cached during a previous session. This is
/// intended to help populate semantic classifications for a host during the time while a solution is loading and
/// semantics may be incomplete or unavailable.
/// </summary>
internal interface ISemanticClassificationCacheService : IWorkspaceService
{
/// <summary>
/// Tries to get cached semantic classifications for the specified document and the specified <paramref
/// name="textSpan"/>. Will return a <c>default</c> array not able to. An empty array indicates that there
/// were cached classifications, but none that intersected the provided <paramref name="textSpan"/>.
/// </summary>
/// <param name="checksum">Pass in <see cref="DocumentStateChecksums.Text"/>. This will ensure that the cached
/// classifications are only returned if they match the content the file currently has.</param>
Task<ImmutableArray<ClassifiedSpan>> GetCachedSemanticClassificationsAsync(
DocumentKey documentKey, TextSpan textSpan, Checksum checksum, CancellationToken cancellationToken);
}
[ExportWorkspaceService(typeof(ISemanticClassificationCacheService)), Shared]
internal class DefaultSemanticClassificationCacheService : ISemanticClassificationCacheService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultSemanticClassificationCacheService()
{
}
public Task<ImmutableArray<ClassifiedSpan>> GetCachedSemanticClassificationsAsync(DocumentKey documentKey, TextSpan textSpan, Checksum checksum, CancellationToken cancellationToken)
=> SpecializedTasks.Default<ImmutableArray<ClassifiedSpan>>();
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/CSharpTest/CSharpSyntaxFactsServiceTests.cs | // 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.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.LanguageServices;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
public sealed class CSharpSyntaxFactsServiceTests
{
private static bool IsQueryKeyword(string markup)
{
MarkupTestFile.GetPosition(markup, out var code, out int position);
var tree = SyntaxFactory.ParseSyntaxTree(code);
var token = tree.GetRoot().FindToken(position);
var service = CSharpSyntaxFacts.Instance;
return service.IsQueryKeyword(token);
}
private static string WrapInMethod(string methodBody)
{
return $@"
class C
{{
void M()
{{
{methodBody}
}}
}}";
}
[Fact]
public void IsQueryKeyword_From()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var result = $$from var1 in collection1")));
}
[Fact]
public void IsQueryKeyword_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var result = from var1 $$in collection1")));
}
[Fact]
public void IsQueryKeyword_Where()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customerOrders = from cust in customers
$$where cust.CustomerID = 1")));
}
[Fact]
public void IsQueryKeyword_Select()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customerOrders = from cust in customers
from ord in orders
where cust.CustomerID == ord.CustomerID
$$select cust.CompanyName, ord.OrderDate")));
}
[Fact]
public void IsQueryKeyword_GroupBy_Group()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
$$group cust by cust.Country
into g")));
}
[Fact]
public void IsQueryKeyword_GroupBy_By()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
group cust $$by cust.Country
into g")));
}
[Fact]
public void IsQueryKeyword_Into()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
group cust by cust.Country
$$into g")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Join()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
$$join pet in pets on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet $$in pets on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_On()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets $$on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Equals()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person $$equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Into()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person equals pet.Owner $$into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_Join_Join()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
$$join pet in pets on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet $$in pets on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_On()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets $$on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_Equals()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person $$equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Let()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var discountedProducts = from prod in products
$$let discount = prod.UnitPrice * 0.1
where discount >= 50
select new { prod.ProductName, prod.UnitPrice, Discount }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_OrderBy()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
$$orderby book.Price descending, book.Title ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_Descending()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
orderby book.Price $$descending, book.Title ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_Ascending()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
orderby book.Price descending, book.Title $$ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_Not_ForEach_In()
{
Assert.False(IsQueryKeyword(WrapInMethod(@"
foreach (var i $$in new int[0])
{
}")));
}
}
}
| // 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.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.LanguageServices;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
public sealed class CSharpSyntaxFactsServiceTests
{
private static bool IsQueryKeyword(string markup)
{
MarkupTestFile.GetPosition(markup, out var code, out int position);
var tree = SyntaxFactory.ParseSyntaxTree(code);
var token = tree.GetRoot().FindToken(position);
var service = CSharpSyntaxFacts.Instance;
return service.IsQueryKeyword(token);
}
private static string WrapInMethod(string methodBody)
{
return $@"
class C
{{
void M()
{{
{methodBody}
}}
}}";
}
[Fact]
public void IsQueryKeyword_From()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var result = $$from var1 in collection1")));
}
[Fact]
public void IsQueryKeyword_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var result = from var1 $$in collection1")));
}
[Fact]
public void IsQueryKeyword_Where()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customerOrders = from cust in customers
$$where cust.CustomerID = 1")));
}
[Fact]
public void IsQueryKeyword_Select()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customerOrders = from cust in customers
from ord in orders
where cust.CustomerID == ord.CustomerID
$$select cust.CompanyName, ord.OrderDate")));
}
[Fact]
public void IsQueryKeyword_GroupBy_Group()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
$$group cust by cust.Country
into g")));
}
[Fact]
public void IsQueryKeyword_GroupBy_By()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
group cust $$by cust.Country
into g")));
}
[Fact]
public void IsQueryKeyword_Into()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var customersByCountry = from cust in customers
group cust by cust.Country
$$into g")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Join()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
$$join pet in pets on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet $$in pets on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_On()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets $$on person equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Equals()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person $$equals pet.Owner into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_GroupJoin_Into()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person equals pet.Owner $$into gj
select new { OwnerName = person.FirstName, Pets = gj };")));
}
[Fact]
public void IsQueryKeyword_Join_Join()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
$$join pet in pets on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_In()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet $$in pets on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_On()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets $$on person equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Join_Equals()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var query = from person in people
join pet in pets on person $$equals pet.Owner
select new { OwnerName = person.FirstName, PetName = pet.Name };")));
}
[Fact]
public void IsQueryKeyword_Let()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var discountedProducts = from prod in products
$$let discount = prod.UnitPrice * 0.1
where discount >= 50
select new { prod.ProductName, prod.UnitPrice, Discount }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_OrderBy()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
$$orderby book.Price descending, book.Title ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_Descending()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
orderby book.Price $$descending, book.Title ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_OrderBy_Ascending()
{
Assert.True(IsQueryKeyword(WrapInMethod(@"
var titlesDescendingPrice = from book in books
orderby book.Price descending, book.Title $$ascending, book.Author
select new { book.Title, book.Price }")));
}
[Fact]
public void IsQueryKeyword_Not_ForEach_In()
{
Assert.False(IsQueryKeyword(WrapInMethod(@"
foreach (var i $$in new int[0])
{
}")));
}
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/VisualStudio/Core/Def/EditorConfigSettings/ServiceProviderExtensions.cs | // 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.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Shell;
namespace Microsoft.VisualStudio.LanguageServices.EditorConfigSettings
{
internal static class ServiceProviderExtensions
{
public static bool TryGetService<TService, TInterface>(this IServiceProvider sp, [NotNullWhen(true)] out TInterface? @interface)
where TInterface : class
{
@interface = sp.GetService<TService, TInterface>(throwOnFailure: false);
return @interface is not null;
}
public static bool TryGetService<TInterface>(this IServiceProvider sp, [NotNullWhen(true)] out TInterface? @interface)
where TInterface : class
{
@interface = sp.GetService<TInterface>();
return @interface is not null;
}
public static TInterface? GetService<TInterface>(this IServiceProvider sp)
where TInterface : class
{
return sp.GetService<TInterface, TInterface>(throwOnFailure: false);
}
}
}
| // 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.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Shell;
namespace Microsoft.VisualStudio.LanguageServices.EditorConfigSettings
{
internal static class ServiceProviderExtensions
{
public static bool TryGetService<TService, TInterface>(this IServiceProvider sp, [NotNullWhen(true)] out TInterface? @interface)
where TInterface : class
{
@interface = sp.GetService<TService, TInterface>(throwOnFailure: false);
return @interface is not null;
}
public static bool TryGetService<TInterface>(this IServiceProvider sp, [NotNullWhen(true)] out TInterface? @interface)
where TInterface : class
{
@interface = sp.GetService<TInterface>();
return @interface is not null;
}
public static TInterface? GetService<TInterface>(this IServiceProvider sp)
where TInterface : class
{
return sp.GetService<TInterface, TInterface>(throwOnFailure: false);
}
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/EditorFeatures/CSharpTest/ConvertNamespace/ConvertToFileScopedNamespaceAnalyzerTests.cs | // 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.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.ConvertNamespace;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.Testing;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertNamespace
{
using VerifyCS = CSharpCodeFixVerifier<ConvertToFileScopedNamespaceDiagnosticAnalyzer, ConvertNamespaceCodeFixProvider>;
public class ConvertToFileScopedNamespaceAnalyzerTests
{
#region Convert To File Scoped
[Fact]
public async Task TestNoConvertToFileScopedInCSharp9()
{
var code = @"
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp9,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertToFileScopedInCSharp10WithBlockScopedPreference()
{
var code = @"
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedInCSharp10WithBlockScopedPreference()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
}
",
FixedCode = @"
namespace $$N;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithMultipleNamespaces()
{
var code = @"
namespace N
{
}
namespace N2
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithNestedNamespaces1()
{
var code = @"
namespace N
{
namespace N2
{
}
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithTopLevelStatement1()
{
var code = @"
{|CS8805:int i = 0;|}
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithTopLevelStatement2()
{
var code = @"
namespace N
{
}
int i = 0;
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
ExpectedDiagnostics =
{
// /0/Test0.cs(6,1): error CS8803: Top-level statements must precede namespace and type declarations.
DiagnosticResult.CompilerError("CS8803").WithSpan(6, 1, 6, 11),
// /0/Test0.cs(6,1): error CS8805: Program using top-level statements must be an executable.
DiagnosticResult.CompilerError("CS8805").WithSpan(6, 1, 6, 11),
},
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithUsing1()
{
await new VerifyCS.Test
{
TestCode = @"
using System;
[|namespace N|]
{
}
",
FixedCode = @"
using System;
namespace $$N;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithUsing2()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
using System;
}
",
FixedCode = @"
namespace $$N;
using System;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithClass()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
class C
{
}
}
",
FixedCode = @"
namespace $$N;
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithClassWithDocComment()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
/// <summary/>
class C
{
}
}
",
FixedCode = @"
namespace $$N;
/// <summary/>
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithMissingCloseBrace()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
/// <summary/>
class C
{
}{|CS1513:|}",
FixedCode = @"
namespace N;
/// <summary/>
class C
{
}",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithCommentOnOpenCurly()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{ // comment
class C
{
}
}
",
FixedCode = @"
namespace $$N; // comment
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithLeadingComment()
{
await new VerifyCS.Test
{
TestCode = @"
// copyright
[|namespace N|]
{
class C
{
}
}
",
FixedCode = @"
// copyright
namespace $$N;
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
#endregion
}
}
| // 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.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.ConvertNamespace;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.Testing;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertNamespace
{
using VerifyCS = CSharpCodeFixVerifier<ConvertToFileScopedNamespaceDiagnosticAnalyzer, ConvertNamespaceCodeFixProvider>;
public class ConvertToFileScopedNamespaceAnalyzerTests
{
#region Convert To File Scoped
[Fact]
public async Task TestNoConvertToFileScopedInCSharp9()
{
var code = @"
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp9,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertToFileScopedInCSharp10WithBlockScopedPreference()
{
var code = @"
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.BlockScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedInCSharp10WithBlockScopedPreference()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
}
",
FixedCode = @"
namespace $$N;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithMultipleNamespaces()
{
var code = @"
namespace N
{
}
namespace N2
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithNestedNamespaces1()
{
var code = @"
namespace N
{
namespace N2
{
}
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithTopLevelStatement1()
{
var code = @"
{|CS8805:int i = 0;|}
namespace N
{
}
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestNoConvertWithTopLevelStatement2()
{
var code = @"
namespace N
{
}
int i = 0;
";
await new VerifyCS.Test
{
TestCode = code,
FixedCode = code,
LanguageVersion = LanguageVersion.CSharp10,
ExpectedDiagnostics =
{
// /0/Test0.cs(6,1): error CS8803: Top-level statements must precede namespace and type declarations.
DiagnosticResult.CompilerError("CS8803").WithSpan(6, 1, 6, 11),
// /0/Test0.cs(6,1): error CS8805: Program using top-level statements must be an executable.
DiagnosticResult.CompilerError("CS8805").WithSpan(6, 1, 6, 11),
},
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithUsing1()
{
await new VerifyCS.Test
{
TestCode = @"
using System;
[|namespace N|]
{
}
",
FixedCode = @"
using System;
namespace $$N;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithUsing2()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
using System;
}
",
FixedCode = @"
namespace $$N;
using System;
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithClass()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
class C
{
}
}
",
FixedCode = @"
namespace $$N;
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithClassWithDocComment()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
/// <summary/>
class C
{
}
}
",
FixedCode = @"
namespace $$N;
/// <summary/>
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithMissingCloseBrace()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{
/// <summary/>
class C
{
}{|CS1513:|}",
FixedCode = @"
namespace N;
/// <summary/>
class C
{
}",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithCommentOnOpenCurly()
{
await new VerifyCS.Test
{
TestCode = @"
[|namespace N|]
{ // comment
class C
{
}
}
",
FixedCode = @"
namespace $$N; // comment
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
[Fact]
public async Task TestConvertToFileScopedWithLeadingComment()
{
await new VerifyCS.Test
{
TestCode = @"
// copyright
[|namespace N|]
{
class C
{
}
}
",
FixedCode = @"
// copyright
namespace $$N;
class C
{
}
",
LanguageVersion = LanguageVersion.CSharp10,
Options =
{
{ CSharpCodeStyleOptions.NamespaceDeclarations, NamespaceDeclarationPreference.FileScoped }
}
}.RunAsync();
}
#endregion
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxKinds.vb | ' 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.
Imports Microsoft.CodeAnalysis.LanguageServices
Namespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Friend Class VisualBasicSyntaxKinds
Implements ISyntaxKinds
Public Shared ReadOnly Instance As New VisualBasicSyntaxKinds()
Protected Sub New()
End Sub
Public Function Convert(Of TSyntaxKind As Structure)(kind As Integer) As TSyntaxKind Implements ISyntaxKinds.Convert
' Boxing/Unboxing casts from Object to TSyntaxKind will be erased by jit.
Return CType(CType(CType(kind, SyntaxKind), Object), TSyntaxKind)
End Function
Public ReadOnly Property ConflictMarkerTrivia As Integer = SyntaxKind.ConflictMarkerTrivia Implements ISyntaxKinds.ConflictMarkerTrivia
Public ReadOnly Property DisabledTextTrivia As Integer = SyntaxKind.DisabledTextTrivia Implements ISyntaxKinds.DisabledTextTrivia
Public ReadOnly Property EndOfLineTrivia As Integer = SyntaxKind.EndOfLineTrivia Implements ISyntaxKinds.EndOfLineTrivia
Public ReadOnly Property SkippedTokensTrivia As Integer = SyntaxKind.SkippedTokensTrivia Implements ISyntaxKinds.SkippedTokensTrivia
Public ReadOnly Property WhitespaceTrivia As Integer = SyntaxKind.WhitespaceTrivia Implements ISyntaxKinds.WhitespaceTrivia
Public ReadOnly Property SingleLineCommentTrivia As Integer = SyntaxKind.CommentTrivia Implements ISyntaxKinds.SingleLineCommentTrivia
Private ReadOnly Property MultiLineCommentTrivia As Integer? Implements ISyntaxKinds.MultiLineCommentTrivia
Public ReadOnly Property CloseBraceToken As Integer = SyntaxKind.CloseBraceToken Implements ISyntaxKinds.CloseBraceToken
Public ReadOnly Property ColonToken As Integer = SyntaxKind.ColonToken Implements ISyntaxKinds.ColonToken
Public ReadOnly Property CharacterLiteralToken As Integer = SyntaxKind.CharacterLiteralToken Implements ISyntaxKinds.CharacterLiteralToken
Public ReadOnly Property DotToken As Integer = SyntaxKind.DotToken Implements ISyntaxKinds.DotToken
Public ReadOnly Property InterpolatedStringTextToken As Integer = SyntaxKind.InterpolatedStringTextToken Implements ISyntaxKinds.InterpolatedStringTextToken
Public ReadOnly Property QuestionToken As Integer = SyntaxKind.QuestionToken Implements ISyntaxKinds.QuestionToken
Public ReadOnly Property StringLiteralToken As Integer = SyntaxKind.StringLiteralToken Implements ISyntaxKinds.StringLiteralToken
Public ReadOnly Property IfKeyword As Integer = SyntaxKind.IfKeyword Implements ISyntaxKinds.IfKeyword
Public ReadOnly Property GenericName As Integer = SyntaxKind.GenericName Implements ISyntaxKinds.GenericName
Public ReadOnly Property IdentifierName As Integer = SyntaxKind.IdentifierName Implements ISyntaxKinds.IdentifierName
Public ReadOnly Property QualifiedName As Integer = SyntaxKind.QualifiedName Implements ISyntaxKinds.QualifiedName
Public ReadOnly Property TupleType As Integer = SyntaxKind.TupleType Implements ISyntaxKinds.TupleType
Public ReadOnly Property CharacterLiteralExpression As Integer = SyntaxKind.CharacterLiteralExpression Implements ISyntaxKinds.CharacterLiteralExpression
Public ReadOnly Property DefaultLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.DefaultLiteralExpression
Public ReadOnly Property FalseLiteralExpression As Integer = SyntaxKind.FalseLiteralExpression Implements ISyntaxKinds.FalseLiteralExpression
Public ReadOnly Property NullLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.NullLiteralExpression
Public ReadOnly Property StringLiteralExpression As Integer = SyntaxKind.StringLiteralExpression Implements ISyntaxKinds.StringLiteralExpression
Public ReadOnly Property TrueLiteralExpression As Integer = SyntaxKind.TrueLiteralExpression Implements ISyntaxKinds.TrueLiteralExpression
Public ReadOnly Property AnonymousObjectCreationExpression As Integer = SyntaxKind.AnonymousObjectCreationExpression Implements ISyntaxKinds.AnonymousObjectCreationExpression
Public ReadOnly Property AwaitExpression As Integer = SyntaxKind.AwaitExpression Implements ISyntaxKinds.AwaitExpression
Public ReadOnly Property BaseExpression As Integer = SyntaxKind.MyBaseExpression Implements ISyntaxKinds.BaseExpression
Public ReadOnly Property ConditionalAccessExpression As Integer = SyntaxKind.ConditionalAccessExpression Implements ISyntaxKinds.ConditionalAccessExpression
Public ReadOnly Property ConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKinds.ConditionalExpression
Public ReadOnly Property InvocationExpression As Integer = SyntaxKind.InvocationExpression Implements ISyntaxKinds.InvocationExpression
Public ReadOnly Property LogicalAndExpression As Integer = SyntaxKind.AndAlsoExpression Implements ISyntaxKinds.LogicalAndExpression
Public ReadOnly Property LogicalOrExpression As Integer = SyntaxKind.OrElseExpression Implements ISyntaxKinds.LogicalOrExpression
Public ReadOnly Property LogicalNotExpression As Integer = SyntaxKind.NotExpression Implements ISyntaxKinds.LogicalNotExpression
Public ReadOnly Property ObjectCreationExpression As Integer = SyntaxKind.ObjectCreationExpression Implements ISyntaxKinds.ObjectCreationExpression
Public ReadOnly Property ParenthesizedExpression As Integer = SyntaxKind.ParenthesizedExpression Implements ISyntaxKinds.ParenthesizedExpression
Public ReadOnly Property QueryExpression As Integer = SyntaxKind.QueryExpression Implements ISyntaxKinds.QueryExpression
Public ReadOnly Property ReferenceEqualsExpression As Integer = SyntaxKind.IsExpression Implements ISyntaxKinds.ReferenceEqualsExpression
Public ReadOnly Property ReferenceNotEqualsExpression As Integer = SyntaxKind.IsNotExpression Implements ISyntaxKinds.ReferenceNotEqualsExpression
Public ReadOnly Property SimpleMemberAccessExpression As Integer = SyntaxKind.SimpleMemberAccessExpression Implements ISyntaxKinds.SimpleMemberAccessExpression
Public ReadOnly Property TernaryConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKinds.TernaryConditionalExpression
Public ReadOnly Property ThisExpression As Integer = SyntaxKind.MeExpression Implements ISyntaxKinds.ThisExpression
Public ReadOnly Property TupleExpression As Integer = SyntaxKind.TupleExpression Implements ISyntaxKinds.TupleExpression
Public ReadOnly Property EndOfFileToken As Integer = SyntaxKind.EndOfFileToken Implements ISyntaxKinds.EndOfFileToken
Public ReadOnly Property AwaitKeyword As Integer = SyntaxKind.AwaitKeyword Implements ISyntaxKinds.AwaitKeyword
Public ReadOnly Property IdentifierToken As Integer = SyntaxKind.IdentifierToken Implements ISyntaxKinds.IdentifierToken
Public ReadOnly Property GlobalKeyword As Integer = SyntaxKind.GlobalKeyword Implements ISyntaxKinds.GlobalKeyword
Public ReadOnly Property IncompleteMember As Integer = SyntaxKind.IncompleteMember Implements ISyntaxKinds.IncompleteMember
Public ReadOnly Property HashToken As Integer = SyntaxKind.HashToken Implements ISyntaxKinds.HashToken
Public ReadOnly Property ExpressionStatement As Integer = SyntaxKind.ExpressionStatement Implements ISyntaxKinds.ExpressionStatement
Public ReadOnly Property ForEachStatement As Integer = SyntaxKind.ForEachStatement Implements ISyntaxKinds.ForEachStatement
Public ReadOnly Property LocalDeclarationStatement As Integer = SyntaxKind.LocalDeclarationStatement Implements ISyntaxKinds.LocalDeclarationStatement
Public ReadOnly Property LockStatement As Integer = SyntaxKind.SyncLockStatement Implements ISyntaxKinds.LockStatement
Public ReadOnly Property ReturnStatement As Integer = SyntaxKind.ReturnStatement Implements ISyntaxKinds.ReturnStatement
Public ReadOnly Property UsingStatement As Integer = SyntaxKind.UsingStatement Implements ISyntaxKinds.UsingStatement
Public ReadOnly Property Attribute As Integer = SyntaxKind.Attribute Implements ISyntaxKinds.Attribute
Public ReadOnly Property Parameter As Integer = SyntaxKind.Parameter Implements ISyntaxKinds.Parameter
Public ReadOnly Property TypeConstraint As Integer = SyntaxKind.TypeConstraint Implements ISyntaxKinds.TypeConstraint
Public ReadOnly Property VariableDeclarator As Integer = SyntaxKind.VariableDeclarator Implements ISyntaxKinds.VariableDeclarator
Public ReadOnly Property FieldDeclaration As Integer = SyntaxKind.FieldDeclaration Implements ISyntaxKinds.FieldDeclaration
Public ReadOnly Property ParameterList As Integer = SyntaxKind.ParameterList Implements ISyntaxKinds.ParameterList
Public ReadOnly Property TypeArgumentList As Integer = SyntaxKind.TypeArgumentList Implements ISyntaxKinds.TypeArgumentList
Public ReadOnly Property GlobalStatement As Integer? Implements ISyntaxKinds.GlobalStatement
Public ReadOnly Property EqualsValueClause As Integer = SyntaxKind.EqualsValue Implements ISyntaxKinds.EqualsValueClause
Public ReadOnly Property Interpolation As Integer = SyntaxKind.Interpolation Implements ISyntaxKinds.Interpolation
Public ReadOnly Property InterpolatedStringExpression As Integer = SyntaxKind.InterpolatedStringExpression Implements ISyntaxKinds.InterpolatedStringExpression
Public ReadOnly Property InterpolatedStringText As Integer = SyntaxKind.InterpolatedStringText Implements ISyntaxKinds.InterpolatedStringText
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.LanguageServices
Namespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Friend Class VisualBasicSyntaxKinds
Implements ISyntaxKinds
Public Shared ReadOnly Instance As New VisualBasicSyntaxKinds()
Protected Sub New()
End Sub
Public Function Convert(Of TSyntaxKind As Structure)(kind As Integer) As TSyntaxKind Implements ISyntaxKinds.Convert
' Boxing/Unboxing casts from Object to TSyntaxKind will be erased by jit.
Return CType(CType(CType(kind, SyntaxKind), Object), TSyntaxKind)
End Function
Public ReadOnly Property ConflictMarkerTrivia As Integer = SyntaxKind.ConflictMarkerTrivia Implements ISyntaxKinds.ConflictMarkerTrivia
Public ReadOnly Property DisabledTextTrivia As Integer = SyntaxKind.DisabledTextTrivia Implements ISyntaxKinds.DisabledTextTrivia
Public ReadOnly Property EndOfLineTrivia As Integer = SyntaxKind.EndOfLineTrivia Implements ISyntaxKinds.EndOfLineTrivia
Public ReadOnly Property SkippedTokensTrivia As Integer = SyntaxKind.SkippedTokensTrivia Implements ISyntaxKinds.SkippedTokensTrivia
Public ReadOnly Property WhitespaceTrivia As Integer = SyntaxKind.WhitespaceTrivia Implements ISyntaxKinds.WhitespaceTrivia
Public ReadOnly Property SingleLineCommentTrivia As Integer = SyntaxKind.CommentTrivia Implements ISyntaxKinds.SingleLineCommentTrivia
Private ReadOnly Property MultiLineCommentTrivia As Integer? Implements ISyntaxKinds.MultiLineCommentTrivia
Public ReadOnly Property CloseBraceToken As Integer = SyntaxKind.CloseBraceToken Implements ISyntaxKinds.CloseBraceToken
Public ReadOnly Property ColonToken As Integer = SyntaxKind.ColonToken Implements ISyntaxKinds.ColonToken
Public ReadOnly Property CharacterLiteralToken As Integer = SyntaxKind.CharacterLiteralToken Implements ISyntaxKinds.CharacterLiteralToken
Public ReadOnly Property DotToken As Integer = SyntaxKind.DotToken Implements ISyntaxKinds.DotToken
Public ReadOnly Property InterpolatedStringTextToken As Integer = SyntaxKind.InterpolatedStringTextToken Implements ISyntaxKinds.InterpolatedStringTextToken
Public ReadOnly Property QuestionToken As Integer = SyntaxKind.QuestionToken Implements ISyntaxKinds.QuestionToken
Public ReadOnly Property StringLiteralToken As Integer = SyntaxKind.StringLiteralToken Implements ISyntaxKinds.StringLiteralToken
Public ReadOnly Property IfKeyword As Integer = SyntaxKind.IfKeyword Implements ISyntaxKinds.IfKeyword
Public ReadOnly Property GenericName As Integer = SyntaxKind.GenericName Implements ISyntaxKinds.GenericName
Public ReadOnly Property IdentifierName As Integer = SyntaxKind.IdentifierName Implements ISyntaxKinds.IdentifierName
Public ReadOnly Property QualifiedName As Integer = SyntaxKind.QualifiedName Implements ISyntaxKinds.QualifiedName
Public ReadOnly Property TupleType As Integer = SyntaxKind.TupleType Implements ISyntaxKinds.TupleType
Public ReadOnly Property CharacterLiteralExpression As Integer = SyntaxKind.CharacterLiteralExpression Implements ISyntaxKinds.CharacterLiteralExpression
Public ReadOnly Property DefaultLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.DefaultLiteralExpression
Public ReadOnly Property FalseLiteralExpression As Integer = SyntaxKind.FalseLiteralExpression Implements ISyntaxKinds.FalseLiteralExpression
Public ReadOnly Property NullLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.NullLiteralExpression
Public ReadOnly Property StringLiteralExpression As Integer = SyntaxKind.StringLiteralExpression Implements ISyntaxKinds.StringLiteralExpression
Public ReadOnly Property TrueLiteralExpression As Integer = SyntaxKind.TrueLiteralExpression Implements ISyntaxKinds.TrueLiteralExpression
Public ReadOnly Property AnonymousObjectCreationExpression As Integer = SyntaxKind.AnonymousObjectCreationExpression Implements ISyntaxKinds.AnonymousObjectCreationExpression
Public ReadOnly Property AwaitExpression As Integer = SyntaxKind.AwaitExpression Implements ISyntaxKinds.AwaitExpression
Public ReadOnly Property BaseExpression As Integer = SyntaxKind.MyBaseExpression Implements ISyntaxKinds.BaseExpression
Public ReadOnly Property ConditionalAccessExpression As Integer = SyntaxKind.ConditionalAccessExpression Implements ISyntaxKinds.ConditionalAccessExpression
Public ReadOnly Property ConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKinds.ConditionalExpression
Public ReadOnly Property InvocationExpression As Integer = SyntaxKind.InvocationExpression Implements ISyntaxKinds.InvocationExpression
Public ReadOnly Property LogicalAndExpression As Integer = SyntaxKind.AndAlsoExpression Implements ISyntaxKinds.LogicalAndExpression
Public ReadOnly Property LogicalOrExpression As Integer = SyntaxKind.OrElseExpression Implements ISyntaxKinds.LogicalOrExpression
Public ReadOnly Property LogicalNotExpression As Integer = SyntaxKind.NotExpression Implements ISyntaxKinds.LogicalNotExpression
Public ReadOnly Property ObjectCreationExpression As Integer = SyntaxKind.ObjectCreationExpression Implements ISyntaxKinds.ObjectCreationExpression
Public ReadOnly Property ParenthesizedExpression As Integer = SyntaxKind.ParenthesizedExpression Implements ISyntaxKinds.ParenthesizedExpression
Public ReadOnly Property QueryExpression As Integer = SyntaxKind.QueryExpression Implements ISyntaxKinds.QueryExpression
Public ReadOnly Property ReferenceEqualsExpression As Integer = SyntaxKind.IsExpression Implements ISyntaxKinds.ReferenceEqualsExpression
Public ReadOnly Property ReferenceNotEqualsExpression As Integer = SyntaxKind.IsNotExpression Implements ISyntaxKinds.ReferenceNotEqualsExpression
Public ReadOnly Property SimpleMemberAccessExpression As Integer = SyntaxKind.SimpleMemberAccessExpression Implements ISyntaxKinds.SimpleMemberAccessExpression
Public ReadOnly Property TernaryConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKinds.TernaryConditionalExpression
Public ReadOnly Property ThisExpression As Integer = SyntaxKind.MeExpression Implements ISyntaxKinds.ThisExpression
Public ReadOnly Property TupleExpression As Integer = SyntaxKind.TupleExpression Implements ISyntaxKinds.TupleExpression
Public ReadOnly Property EndOfFileToken As Integer = SyntaxKind.EndOfFileToken Implements ISyntaxKinds.EndOfFileToken
Public ReadOnly Property AwaitKeyword As Integer = SyntaxKind.AwaitKeyword Implements ISyntaxKinds.AwaitKeyword
Public ReadOnly Property IdentifierToken As Integer = SyntaxKind.IdentifierToken Implements ISyntaxKinds.IdentifierToken
Public ReadOnly Property GlobalKeyword As Integer = SyntaxKind.GlobalKeyword Implements ISyntaxKinds.GlobalKeyword
Public ReadOnly Property IncompleteMember As Integer = SyntaxKind.IncompleteMember Implements ISyntaxKinds.IncompleteMember
Public ReadOnly Property HashToken As Integer = SyntaxKind.HashToken Implements ISyntaxKinds.HashToken
Public ReadOnly Property ExpressionStatement As Integer = SyntaxKind.ExpressionStatement Implements ISyntaxKinds.ExpressionStatement
Public ReadOnly Property ForEachStatement As Integer = SyntaxKind.ForEachStatement Implements ISyntaxKinds.ForEachStatement
Public ReadOnly Property LocalDeclarationStatement As Integer = SyntaxKind.LocalDeclarationStatement Implements ISyntaxKinds.LocalDeclarationStatement
Public ReadOnly Property LockStatement As Integer = SyntaxKind.SyncLockStatement Implements ISyntaxKinds.LockStatement
Public ReadOnly Property ReturnStatement As Integer = SyntaxKind.ReturnStatement Implements ISyntaxKinds.ReturnStatement
Public ReadOnly Property UsingStatement As Integer = SyntaxKind.UsingStatement Implements ISyntaxKinds.UsingStatement
Public ReadOnly Property Attribute As Integer = SyntaxKind.Attribute Implements ISyntaxKinds.Attribute
Public ReadOnly Property Parameter As Integer = SyntaxKind.Parameter Implements ISyntaxKinds.Parameter
Public ReadOnly Property TypeConstraint As Integer = SyntaxKind.TypeConstraint Implements ISyntaxKinds.TypeConstraint
Public ReadOnly Property VariableDeclarator As Integer = SyntaxKind.VariableDeclarator Implements ISyntaxKinds.VariableDeclarator
Public ReadOnly Property FieldDeclaration As Integer = SyntaxKind.FieldDeclaration Implements ISyntaxKinds.FieldDeclaration
Public ReadOnly Property ParameterList As Integer = SyntaxKind.ParameterList Implements ISyntaxKinds.ParameterList
Public ReadOnly Property TypeArgumentList As Integer = SyntaxKind.TypeArgumentList Implements ISyntaxKinds.TypeArgumentList
Public ReadOnly Property GlobalStatement As Integer? Implements ISyntaxKinds.GlobalStatement
Public ReadOnly Property EqualsValueClause As Integer = SyntaxKind.EqualsValue Implements ISyntaxKinds.EqualsValueClause
Public ReadOnly Property Interpolation As Integer = SyntaxKind.Interpolation Implements ISyntaxKinds.Interpolation
Public ReadOnly Property InterpolatedStringExpression As Integer = SyntaxKind.InterpolatedStringExpression Implements ISyntaxKinds.InterpolatedStringExpression
Public ReadOnly Property InterpolatedStringText As Integer = SyntaxKind.InterpolatedStringText Implements ISyntaxKinds.InterpolatedStringText
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Features/VisualBasic/Portable/Wrapping/ChainedExpression/VisualBasicChainedExpressionWrapper.vb | ' 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.
Imports Microsoft.CodeAnalysis.VisualBasic.Indentation
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Wrapping.ChainedExpression
Namespace Microsoft.CodeAnalysis.VisualBasic.Wrapping.ChainedExpression
Friend Class VisualBasicChainedExpressionWrapper
Inherits AbstractChainedExpressionWrapper(Of NameSyntax, ArgumentListSyntax)
Public Sub New()
MyBase.New(VisualBasicIndentationService.WithoutParameterAlignmentInstance, VisualBasicSyntaxFacts.Instance)
End Sub
Protected Overrides Function GetNewLineBeforeOperatorTrivia(newLine As SyntaxTriviaList) As SyntaxTriviaList
Return newLine.InsertRange(0, {SyntaxFactory.WhitespaceTrivia(" "), SyntaxFactory.LineContinuationTrivia("_")})
End Function
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.VisualBasic.Indentation
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Wrapping.ChainedExpression
Namespace Microsoft.CodeAnalysis.VisualBasic.Wrapping.ChainedExpression
Friend Class VisualBasicChainedExpressionWrapper
Inherits AbstractChainedExpressionWrapper(Of NameSyntax, ArgumentListSyntax)
Public Sub New()
MyBase.New(VisualBasicIndentationService.WithoutParameterAlignmentInstance, VisualBasicSyntaxFacts.Instance)
End Sub
Protected Overrides Function GetNewLineBeforeOperatorTrivia(newLine As SyntaxTriviaList) As SyntaxTriviaList
Return newLine.InsertRange(0, {SyntaxFactory.WhitespaceTrivia(" "), SyntaxFactory.LineContinuationTrivia("_")})
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/VisualBasicInstructionDecoder.vb | ' 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.
Imports System.Collections.Immutable
Imports System.Reflection.Metadata
Imports System.Reflection.Metadata.Ecma335
Imports Microsoft.CodeAnalysis.ExpressionEvaluator
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Imports Microsoft.VisualStudio.Debugger
Imports Microsoft.VisualStudio.Debugger.Clr
Imports System.Text
Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
Friend NotInheritable Class VisualBasicInstructionDecoder : Inherits InstructionDecoder(Of VisualBasicCompilation, MethodSymbol, PEModuleSymbol, TypeSymbol, TypeParameterSymbol)
' These strings were not localized in the old EE. We'll keep them that way
' so as not to break consumers who may have been parsing frame names...
Private Const s_closureDisplayName As String = "<closure>"
Private Const s_lambdaDisplayName As String = "<lambda{0}>"
''' <summary>
''' Singleton instance of <see cref="VisualBasicInstructionDecoder"/> (created using default constructor).
''' </summary>
Friend Shared ReadOnly Instance As VisualBasicInstructionDecoder = New VisualBasicInstructionDecoder()
Private Sub New()
End Sub
Friend Overrides Sub AppendFullName(builder As StringBuilder, method As MethodSymbol)
Dim parts = method.ToDisplayParts(DisplayFormat)
Dim numParts = parts.Length
For i = 0 To numParts - 1
Dim part = parts(i)
Dim displayString = part.ToString()
Select Case part.Kind
Case SymbolDisplayPartKind.ClassName
If Not displayString.StartsWith(StringConstants.DisplayClassPrefix, StringComparison.Ordinal) Then
builder.Append(displayString)
Else
' Drop any remaining display class name parts and the subsequent dot...
Do
i += 1
Loop While ((i < numParts) AndAlso parts(i).Kind <> SymbolDisplayPartKind.MethodName)
i -= 1
End If
Case SymbolDisplayPartKind.MethodName
If displayString.StartsWith(StringConstants.LambdaMethodNamePrefix, StringComparison.Ordinal) Then
builder.Append(s_closureDisplayName)
builder.Append("."c)
' NOTE: The old implementation only appended the first ordinal number. Since this is not useful
' in uniquely identifying the lambda, we'll append the entire ordinal suffix (which may contain
' multiple numbers, as well as '-' or '_').
builder.AppendFormat(s_lambdaDisplayName, displayString.Substring(StringConstants.LambdaMethodNamePrefix.Length))
Else
builder.Append(displayString)
End If
Case SymbolDisplayPartKind.PropertyName
builder.Append(method.Name)
Case Else
builder.Append(displayString)
End Select
Next
End Sub
Friend Overrides Function ConstructMethod(method As MethodSymbol, typeParameters As ImmutableArray(Of TypeParameterSymbol), typeArguments As ImmutableArray(Of TypeSymbol)) As MethodSymbol
Dim methodArity = method.Arity
Dim methodArgumentStartIndex = typeParameters.Length - methodArity
Dim typeMap = TypeSubstitution.Create(
method,
ImmutableArray.Create(typeParameters, 0, methodArgumentStartIndex),
ImmutableArray.Create(typeArguments, 0, methodArgumentStartIndex))
Dim substitutedType = typeMap.SubstituteNamedType(method.ContainingType)
method = method.AsMember(substitutedType)
If methodArity > 0 Then
method = method.Construct(ImmutableArray.Create(typeArguments, methodArgumentStartIndex, methodArity))
End If
Return method
End Function
Friend Overrides Function GetAllTypeParameters(method As MethodSymbol) As ImmutableArray(Of TypeParameterSymbol)
Return method.GetAllTypeParameters()
End Function
Friend Overrides Function GetCompilation(moduleInstance As DkmClrModuleInstance) As VisualBasicCompilation
Dim appDomain = moduleInstance.AppDomain
Dim moduleVersionId = moduleInstance.Mvid
Dim previous = appDomain.GetMetadataContext(Of VisualBasicMetadataContext)()
Dim metadataBlocks = moduleInstance.RuntimeInstance.GetMetadataBlocks(appDomain, previous.MetadataBlocks)
Dim kind = GetMakeAssemblyReferencesKind()
Dim contextId = MetadataContextId.GetContextId(moduleVersionId, kind)
Dim assemblyContexts = If(previous.Matches(metadataBlocks), previous.AssemblyContexts, ImmutableDictionary(Of MetadataContextId, VisualBasicMetadataContext).Empty)
Dim previousContext As VisualBasicMetadataContext = Nothing
assemblyContexts.TryGetValue(contextId, previousContext)
Dim compilation = previousContext.Compilation
If compilation Is Nothing Then
compilation = metadataBlocks.ToCompilation(moduleVersionId, kind)
appDomain.SetMetadataContext(
New MetadataContext(Of VisualBasicMetadataContext)(
metadataBlocks,
assemblyContexts.SetItem(contextId, New VisualBasicMetadataContext(compilation))),
report:=kind = MakeAssemblyReferencesKind.AllReferences)
End If
Return compilation
End Function
Friend Overrides Function GetMethod(compilation As VisualBasicCompilation, instructionAddress As DkmClrInstructionAddress) As MethodSymbol
Dim methodHandle = CType(MetadataTokens.Handle(instructionAddress.MethodId.Token), MethodDefinitionHandle)
Return compilation.GetSourceMethod(instructionAddress.ModuleInstance.Mvid, methodHandle)
End Function
Friend Overrides Function GetTypeNameDecoder(compilation As VisualBasicCompilation, method As MethodSymbol) As TypeNameDecoder(Of PEModuleSymbol, TypeSymbol)
Debug.Assert(TypeOf method Is PEMethodSymbol)
Return New EETypeNameDecoder(compilation, DirectCast(method.ContainingModule, PEModuleSymbol))
End Function
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports System.Reflection.Metadata
Imports System.Reflection.Metadata.Ecma335
Imports Microsoft.CodeAnalysis.ExpressionEvaluator
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Imports Microsoft.VisualStudio.Debugger
Imports Microsoft.VisualStudio.Debugger.Clr
Imports System.Text
Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
Friend NotInheritable Class VisualBasicInstructionDecoder : Inherits InstructionDecoder(Of VisualBasicCompilation, MethodSymbol, PEModuleSymbol, TypeSymbol, TypeParameterSymbol)
' These strings were not localized in the old EE. We'll keep them that way
' so as not to break consumers who may have been parsing frame names...
Private Const s_closureDisplayName As String = "<closure>"
Private Const s_lambdaDisplayName As String = "<lambda{0}>"
''' <summary>
''' Singleton instance of <see cref="VisualBasicInstructionDecoder"/> (created using default constructor).
''' </summary>
Friend Shared ReadOnly Instance As VisualBasicInstructionDecoder = New VisualBasicInstructionDecoder()
Private Sub New()
End Sub
Friend Overrides Sub AppendFullName(builder As StringBuilder, method As MethodSymbol)
Dim parts = method.ToDisplayParts(DisplayFormat)
Dim numParts = parts.Length
For i = 0 To numParts - 1
Dim part = parts(i)
Dim displayString = part.ToString()
Select Case part.Kind
Case SymbolDisplayPartKind.ClassName
If Not displayString.StartsWith(StringConstants.DisplayClassPrefix, StringComparison.Ordinal) Then
builder.Append(displayString)
Else
' Drop any remaining display class name parts and the subsequent dot...
Do
i += 1
Loop While ((i < numParts) AndAlso parts(i).Kind <> SymbolDisplayPartKind.MethodName)
i -= 1
End If
Case SymbolDisplayPartKind.MethodName
If displayString.StartsWith(StringConstants.LambdaMethodNamePrefix, StringComparison.Ordinal) Then
builder.Append(s_closureDisplayName)
builder.Append("."c)
' NOTE: The old implementation only appended the first ordinal number. Since this is not useful
' in uniquely identifying the lambda, we'll append the entire ordinal suffix (which may contain
' multiple numbers, as well as '-' or '_').
builder.AppendFormat(s_lambdaDisplayName, displayString.Substring(StringConstants.LambdaMethodNamePrefix.Length))
Else
builder.Append(displayString)
End If
Case SymbolDisplayPartKind.PropertyName
builder.Append(method.Name)
Case Else
builder.Append(displayString)
End Select
Next
End Sub
Friend Overrides Function ConstructMethod(method As MethodSymbol, typeParameters As ImmutableArray(Of TypeParameterSymbol), typeArguments As ImmutableArray(Of TypeSymbol)) As MethodSymbol
Dim methodArity = method.Arity
Dim methodArgumentStartIndex = typeParameters.Length - methodArity
Dim typeMap = TypeSubstitution.Create(
method,
ImmutableArray.Create(typeParameters, 0, methodArgumentStartIndex),
ImmutableArray.Create(typeArguments, 0, methodArgumentStartIndex))
Dim substitutedType = typeMap.SubstituteNamedType(method.ContainingType)
method = method.AsMember(substitutedType)
If methodArity > 0 Then
method = method.Construct(ImmutableArray.Create(typeArguments, methodArgumentStartIndex, methodArity))
End If
Return method
End Function
Friend Overrides Function GetAllTypeParameters(method As MethodSymbol) As ImmutableArray(Of TypeParameterSymbol)
Return method.GetAllTypeParameters()
End Function
Friend Overrides Function GetCompilation(moduleInstance As DkmClrModuleInstance) As VisualBasicCompilation
Dim appDomain = moduleInstance.AppDomain
Dim moduleVersionId = moduleInstance.Mvid
Dim previous = appDomain.GetMetadataContext(Of VisualBasicMetadataContext)()
Dim metadataBlocks = moduleInstance.RuntimeInstance.GetMetadataBlocks(appDomain, previous.MetadataBlocks)
Dim kind = GetMakeAssemblyReferencesKind()
Dim contextId = MetadataContextId.GetContextId(moduleVersionId, kind)
Dim assemblyContexts = If(previous.Matches(metadataBlocks), previous.AssemblyContexts, ImmutableDictionary(Of MetadataContextId, VisualBasicMetadataContext).Empty)
Dim previousContext As VisualBasicMetadataContext = Nothing
assemblyContexts.TryGetValue(contextId, previousContext)
Dim compilation = previousContext.Compilation
If compilation Is Nothing Then
compilation = metadataBlocks.ToCompilation(moduleVersionId, kind)
appDomain.SetMetadataContext(
New MetadataContext(Of VisualBasicMetadataContext)(
metadataBlocks,
assemblyContexts.SetItem(contextId, New VisualBasicMetadataContext(compilation))),
report:=kind = MakeAssemblyReferencesKind.AllReferences)
End If
Return compilation
End Function
Friend Overrides Function GetMethod(compilation As VisualBasicCompilation, instructionAddress As DkmClrInstructionAddress) As MethodSymbol
Dim methodHandle = CType(MetadataTokens.Handle(instructionAddress.MethodId.Token), MethodDefinitionHandle)
Return compilation.GetSourceMethod(instructionAddress.ModuleInstance.Mvid, methodHandle)
End Function
Friend Overrides Function GetTypeNameDecoder(compilation As VisualBasicCompilation, method As MethodSymbol) As TypeNameDecoder(Of PEModuleSymbol, TypeSymbol)
Debug.Assert(TypeOf method Is PEMethodSymbol)
Return New EETypeNameDecoder(compilation, DirectCast(method.ContainingModule, PEModuleSymbol))
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/VisualStudio/Core/Def/Implementation/CommonControls/NewTypeDestinationSelectionViewModel.cs | // 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.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CommonControls
{
internal class NewTypeDestinationSelectionViewModel : AbstractNotifyPropertyChanged
{
public static NewTypeDestinationSelectionViewModel Default = new(
string.Empty,
LanguageNames.CSharp,
string.Empty,
string.Empty,
ImmutableArray<string>.Empty,
null
);
private readonly string _fileExtension;
private readonly string _defaultNamespace;
private readonly string _generatedNameTypeParameterSuffix;
private readonly ImmutableArray<string> _conflictingNames;
private readonly string _defaultName;
private readonly ISyntaxFactsService? _syntaxFactsService;
private readonly string _languageName;
public NewTypeDestinationSelectionViewModel(
string defaultName,
string languageName,
string defaultNamespace,
string generatedNameTypeParameterSuffix,
ImmutableArray<string> conflictingNames,
ISyntaxFactsService? syntaxFactsService)
{
_defaultName = defaultName;
_fileExtension = languageName == LanguageNames.CSharp ? ".cs" : ".vb";
_languageName = languageName;
_generatedNameTypeParameterSuffix = generatedNameTypeParameterSuffix;
_conflictingNames = conflictingNames;
_defaultNamespace = defaultNamespace;
_typeName = _defaultName;
_syntaxFactsService = syntaxFactsService;
_fileName = $"{defaultName}{_fileExtension}";
}
private string _typeName;
public string TypeName
{
get
{
return _typeName;
}
set
{
if (SetProperty(ref _typeName, value))
{
FileName = string.Format("{0}{1}", value.Trim(), _fileExtension);
NotifyPropertyChanged(nameof(GeneratedName));
}
}
}
public string GeneratedName
{
get
{
return string.Format(
"{0}{1}{2}",
string.IsNullOrEmpty(_defaultNamespace) ? string.Empty : _defaultNamespace + ".",
_typeName.Trim(),
_generatedNameTypeParameterSuffix);
}
}
private string _fileName;
public string FileName
{
get { return _fileName; }
set { SetProperty(ref _fileName, value); }
}
private NewTypeDestination _destination = NewTypeDestination.NewFile;
public NewTypeDestination Destination
{
get { return _destination; }
set
{
if (SetProperty(ref _destination, value))
{
NotifyPropertyChanged(nameof(FileNameEnabled));
}
}
}
internal bool TrySubmit([NotNullWhen(returnValue: false)] out string? message)
{
message = null;
if (_syntaxFactsService is null)
{
throw new InvalidOperationException();
}
var trimmedName = TypeName.Trim();
if (_conflictingNames.Contains(trimmedName))
{
message = ServicesVSResources.Name_conflicts_with_an_existing_type_name;
return false;
}
if (!_syntaxFactsService.IsValidIdentifier(trimmedName))
{
message = string.Format(ServicesVSResources.Name_is_not_a_valid_0_identifier, _languageName);
return false;
}
var trimmedFileName = FileName.Trim();
if (!Path.GetExtension(trimmedFileName).Equals(_fileExtension, StringComparison.OrdinalIgnoreCase))
{
message = string.Format(ServicesVSResources.File_name_must_have_the_0_extension, _fileExtension);
return false;
}
if (trimmedFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
message = ServicesVSResources.Illegal_characters_in_path;
return false;
}
return true;
}
public bool FileNameEnabled => Destination == NewTypeDestination.NewFile;
}
internal enum NewTypeDestination
{
CurrentFile,
NewFile
};
}
| // 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.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CommonControls
{
internal class NewTypeDestinationSelectionViewModel : AbstractNotifyPropertyChanged
{
public static NewTypeDestinationSelectionViewModel Default = new(
string.Empty,
LanguageNames.CSharp,
string.Empty,
string.Empty,
ImmutableArray<string>.Empty,
null
);
private readonly string _fileExtension;
private readonly string _defaultNamespace;
private readonly string _generatedNameTypeParameterSuffix;
private readonly ImmutableArray<string> _conflictingNames;
private readonly string _defaultName;
private readonly ISyntaxFactsService? _syntaxFactsService;
private readonly string _languageName;
public NewTypeDestinationSelectionViewModel(
string defaultName,
string languageName,
string defaultNamespace,
string generatedNameTypeParameterSuffix,
ImmutableArray<string> conflictingNames,
ISyntaxFactsService? syntaxFactsService)
{
_defaultName = defaultName;
_fileExtension = languageName == LanguageNames.CSharp ? ".cs" : ".vb";
_languageName = languageName;
_generatedNameTypeParameterSuffix = generatedNameTypeParameterSuffix;
_conflictingNames = conflictingNames;
_defaultNamespace = defaultNamespace;
_typeName = _defaultName;
_syntaxFactsService = syntaxFactsService;
_fileName = $"{defaultName}{_fileExtension}";
}
private string _typeName;
public string TypeName
{
get
{
return _typeName;
}
set
{
if (SetProperty(ref _typeName, value))
{
FileName = string.Format("{0}{1}", value.Trim(), _fileExtension);
NotifyPropertyChanged(nameof(GeneratedName));
}
}
}
public string GeneratedName
{
get
{
return string.Format(
"{0}{1}{2}",
string.IsNullOrEmpty(_defaultNamespace) ? string.Empty : _defaultNamespace + ".",
_typeName.Trim(),
_generatedNameTypeParameterSuffix);
}
}
private string _fileName;
public string FileName
{
get { return _fileName; }
set { SetProperty(ref _fileName, value); }
}
private NewTypeDestination _destination = NewTypeDestination.NewFile;
public NewTypeDestination Destination
{
get { return _destination; }
set
{
if (SetProperty(ref _destination, value))
{
NotifyPropertyChanged(nameof(FileNameEnabled));
}
}
}
internal bool TrySubmit([NotNullWhen(returnValue: false)] out string? message)
{
message = null;
if (_syntaxFactsService is null)
{
throw new InvalidOperationException();
}
var trimmedName = TypeName.Trim();
if (_conflictingNames.Contains(trimmedName))
{
message = ServicesVSResources.Name_conflicts_with_an_existing_type_name;
return false;
}
if (!_syntaxFactsService.IsValidIdentifier(trimmedName))
{
message = string.Format(ServicesVSResources.Name_is_not_a_valid_0_identifier, _languageName);
return false;
}
var trimmedFileName = FileName.Trim();
if (!Path.GetExtension(trimmedFileName).Equals(_fileExtension, StringComparison.OrdinalIgnoreCase))
{
message = string.Format(ServicesVSResources.File_name_must_have_the_0_extension, _fileExtension);
return false;
}
if (trimmedFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
message = ServicesVSResources.Illegal_characters_in_path;
return false;
}
return true;
}
public bool FileNameEnabled => Destination == NewTypeDestination.NewFile;
}
internal enum NewTypeDestination
{
CurrentFile,
NewFile
};
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/VisualBasic/Test/Syntax/Parser/ParseAsyncTests.vb | ' 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.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Test.Utilities
Public Class ParseAsyncTests
Inherits BasicTestBase
<Fact>
Public Sub ParseAsyncModifier()
Dim tree = ParseAndVerify(<![CDATA[
Imports Async = System.Threading.Tasks.Task
Module Program
Public Const Async As Integer = 0
Public Async
<Async(Async)>
Async Function M() As Async
Dim l = Sub()
Dim async As Async = Nothing
End Sub
Dim l2 = Async Sub()
Dim async As Async = Nothing
End Sub
End Function
End Module
Class AsyncAttribute
Inherits Attribute
Sub New(p)
End Sub
End Class]]>)
Assert.Equal(2, Aggregate t In tree.GetRoot().DescendantTokens Where t.Kind = SyntaxKind.AsyncKeyword Into Count())
Dim fields = tree.GetRoot().DescendantNodes.OfType(Of FieldDeclarationSyntax)().ToArray()
Assert.Equal(2, Aggregate f In fields Where f.Declarators(0).Names(0).Identifier.ValueText = "Async" Into Count())
End Sub
<Fact>
Public Sub ParseAwaitExpressions()
Dim tree = ParseAndVerify(<![CDATA[
Imports System.Console
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Async Sub M()
Await t1
WriteLine(Await t2)
End Sub
Sub M2()
Await t1
WriteLine(Await t2)
End Sub
Async Function N() As Task(Of Integer)
Await t1
Return Await t2
End Function
Function N2()
Await t1
Return (Await t2)
End Function
End Module]]>,
<errors>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="206" end="208"/>
<error id="32017" message="Comma, ')', or a valid expression continuation expected." start="234" end="236"/>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="398" end="400"/>
<error id="30198" message="')' expected." start="424" end="424"/>
</errors>)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax)()
Assert.Equal(4, awaitExpressions.Count)
Dim firstStatementOfM = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfM2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
End Sub
<Fact>
Public Sub ParseAwaitExpressionsWithPrecedence()
Dim tree = ParseAndVerify(<![CDATA[
Module Program
Async Function M(a As Task(Of Integer), x As Task(Of Integer), y As Task(Of Integer), b As Task(Of Integer)) As Task(Of Integer)
Return Await a * Await x ^ Await y + Await b
End Function
End Module]]>)
Dim returnStatement = tree.GetRoot().DescendantNodes.OfType(Of ReturnStatementSyntax).Single()
Dim expression = CType(returnStatement.Expression, BinaryExpressionSyntax)
Assert.Equal(SyntaxKind.AddExpression, expression.Kind)
Assert.Equal(SyntaxKind.MultiplyExpression, expression.Left.Kind)
Dim left = CType(expression.Left, BinaryExpressionSyntax)
Assert.Equal(SyntaxKind.AwaitExpression, left.Left.Kind)
Assert.Equal(SyntaxKind.ExponentiateExpression, left.Right.Kind)
Dim right = expression.Right
Assert.Equal(SyntaxKind.AwaitExpression, right.Kind)
End Sub
<Fact>
Public Sub ParseAwaitStatements()
Dim tree = ParseAndVerify(<![CDATA[
Imports System.Console
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Async Sub M()
' await 1
Await t1
End Sub
Sub M2()
' await 2
Await t1
Dim lambda = Async Sub() If True Then Await t1 : Await t2 ' await 3 and 4
End Sub
Async Function N() As Task(Of Integer)
' await 5
Await t1
' await 6
Return Await t2
End Function
Function N2()
Await t1
Return (Await t2)
End Function
Async Function N3(a, x, y) As Task
' This is a parse error, end of statement expected after 'Await a'
Await a * Await x * Await y
End Function
End Module]]>,
<errors>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="177" end="179"/>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="407" end="409"/>
<error id="30198" message="')' expected." start="433" end="433"/>
<error id="30205" message="End of statement expected." start="588" end="589"/>
</errors>)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax)().ToArray()
Assert.Equal(6, awaitExpressions.Count)
Dim firstStatementOfM = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfM2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
End Sub
<Fact>
Public Sub ParseAsyncLambdas()
Dim tree = ParseAndVerify(<![CDATA[
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Private f As Integer
Sub Main()
' Statement
Dim slAsyncSub1 = Async Sub() Await t1
' Assignment
Dim slAsyncSub2 = Async Sub() f = Await t2
' Expression
Dim slAsyncFunction1 = Async Function() Await t2
' Comparison
Dim slAsyncFunction2 = Async Function() f = Await t2
Dim mlAsyncSub = Async Sub()
Await t1
End Sub
Dim mlAsyncFunction1 = Async Function()
Await t1
End Function
Dim mlAsyncFunction2 = Async Function()
Await t1
Return Await t2
End Function
End Sub
End Module]]>)
Dim lambdas = tree.GetRoot().DescendantNodes.OfType(Of LambdaExpressionSyntax)().ToArray()
Assert.Equal(7, lambdas.Count)
Assert.Equal(4, lambdas.Count(Function(l) SyntaxFacts.IsSingleLineLambdaExpression(l.Kind)))
Assert.Equal(SyntaxKind.ExpressionStatement, CType(lambdas(0), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(0), SingleLineLambdaExpressionSyntax).Body, ExpressionStatementSyntax).Expression.Kind)
Assert.Equal(SyntaxKind.SimpleAssignmentStatement, CType(lambdas(1), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(1), SingleLineLambdaExpressionSyntax).Body, AssignmentStatementSyntax).Right.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(lambdas(2), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.EqualsExpression, CType(lambdas(3), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(3), SingleLineLambdaExpressionSyntax).Body, BinaryExpressionSyntax).Right.Kind)
Assert.Equal(3, lambdas.Count(Function(l) SyntaxFacts.IsMultiLineLambdaExpression(l.Kind)))
End Sub
<Fact>
Public Sub ParseAsyncWithNesting()
Dim tree = VisualBasicSyntaxTree.ParseText(<![CDATA[
Imports Async = System.Threading.Tasks.Task
Class C
Public Const Async As Integer = 0
<Async(Async)>
Async Function M() As Async
Dim t As Task
Await (t) ' Yes
Dim lambda1 = Function() Await (t) ' No
Dim lambda1a = Sub() Await (t) ' No
Dim lambda1b = Async Function() Await t ' Yes
Dim lambda1c = Async Function()
Await (Sub()
Await (Function() Await (Function() (Function() Async Sub() Await t)())())
End Sub) ' Yes, No, No, Yes
Return Await t ' Yes
End Function
[Await] t ' No
End Function
Sub Await(Optional p = Nothing)
Dim t As Task
Await (t) ' No
Dim lambda1 = Async Function() Await (t) ' Yes
Dim lambda1a = Async Sub() Await (t) ' Yes
Dim lambda1b = Function() Await (t) ' No
Dim lambda1c = Function()
Await (Async Sub()
Await (Async Function() Await (Async Function() (Function() Sub() Await t)())())
End Sub) ' No, Yes, Yes, No
Return Await (t) ' No
End Function
Await t
End Sub
Function Await(t)
Return Nothing
End Function
End Class
Class AsyncAttribute
Inherits Attribute
Sub New(p)
End Sub
End Class]]>.Value)
' Error BC30800: Method arguments must be enclosed in parentheses.
Assert.True(Aggregate d In tree.GetDiagnostics() Into All(d.Code = ERRID.ERR_ObsoleteArgumentsNeedParens))
Dim asyncExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
Assert.Equal(9, asyncExpressions.Count)
Dim invocationExpression = tree.GetRoot().DescendantNodes.OfType(Of InvocationExpressionSyntax).ToArray()
Assert.Equal(9, asyncExpressions.Count)
Dim allParsedExpressions = tree.GetRoot().DescendantNodes.OfType(Of ExpressionSyntax)()
Dim parsedExpressions = From expression In allParsedExpressions
Where expression.Kind = SyntaxKind.AwaitExpression OrElse
(expression.Kind = SyntaxKind.IdentifierName AndAlso DirectCast(expression, IdentifierNameSyntax).Identifier.ValueText.Equals("Await"))
Order By expression.Position
Select expression.Kind
Dim expected = {SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName}
Assert.Equal(expected, parsedExpressions)
End Sub
<Fact>
Public Sub ParseAwaitInScriptingAndInteractive()
Dim source = "
Dim i = Await T + Await(T) ' Yes, Yes
Dim l = Sub()
Await T ' No
End Sub
Function M()
Return Await T ' No
End Function
Async Sub N()
Await T ' Yes
Await(T) ' Yes
End Sub
Async Function F()
Return Await(T) ' Yes
End Function"
Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
Assert.Equal(5, awaitExpressions.Count)
Dim awaitParsedAsIdentifier = tree.GetRoot().DescendantNodes.OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText.Equals("Await")).ToArray()
Assert.Equal(2, awaitParsedAsIdentifier.Count)
End Sub
End Class
| ' 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.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Test.Utilities
Public Class ParseAsyncTests
Inherits BasicTestBase
<Fact>
Public Sub ParseAsyncModifier()
Dim tree = ParseAndVerify(<![CDATA[
Imports Async = System.Threading.Tasks.Task
Module Program
Public Const Async As Integer = 0
Public Async
<Async(Async)>
Async Function M() As Async
Dim l = Sub()
Dim async As Async = Nothing
End Sub
Dim l2 = Async Sub()
Dim async As Async = Nothing
End Sub
End Function
End Module
Class AsyncAttribute
Inherits Attribute
Sub New(p)
End Sub
End Class]]>)
Assert.Equal(2, Aggregate t In tree.GetRoot().DescendantTokens Where t.Kind = SyntaxKind.AsyncKeyword Into Count())
Dim fields = tree.GetRoot().DescendantNodes.OfType(Of FieldDeclarationSyntax)().ToArray()
Assert.Equal(2, Aggregate f In fields Where f.Declarators(0).Names(0).Identifier.ValueText = "Async" Into Count())
End Sub
<Fact>
Public Sub ParseAwaitExpressions()
Dim tree = ParseAndVerify(<![CDATA[
Imports System.Console
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Async Sub M()
Await t1
WriteLine(Await t2)
End Sub
Sub M2()
Await t1
WriteLine(Await t2)
End Sub
Async Function N() As Task(Of Integer)
Await t1
Return Await t2
End Function
Function N2()
Await t1
Return (Await t2)
End Function
End Module]]>,
<errors>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="206" end="208"/>
<error id="32017" message="Comma, ')', or a valid expression continuation expected." start="234" end="236"/>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="398" end="400"/>
<error id="30198" message="')' expected." start="424" end="424"/>
</errors>)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax)()
Assert.Equal(4, awaitExpressions.Count)
Dim firstStatementOfM = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfM2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
End Sub
<Fact>
Public Sub ParseAwaitExpressionsWithPrecedence()
Dim tree = ParseAndVerify(<![CDATA[
Module Program
Async Function M(a As Task(Of Integer), x As Task(Of Integer), y As Task(Of Integer), b As Task(Of Integer)) As Task(Of Integer)
Return Await a * Await x ^ Await y + Await b
End Function
End Module]]>)
Dim returnStatement = tree.GetRoot().DescendantNodes.OfType(Of ReturnStatementSyntax).Single()
Dim expression = CType(returnStatement.Expression, BinaryExpressionSyntax)
Assert.Equal(SyntaxKind.AddExpression, expression.Kind)
Assert.Equal(SyntaxKind.MultiplyExpression, expression.Left.Kind)
Dim left = CType(expression.Left, BinaryExpressionSyntax)
Assert.Equal(SyntaxKind.AwaitExpression, left.Left.Kind)
Assert.Equal(SyntaxKind.ExponentiateExpression, left.Right.Kind)
Dim right = expression.Right
Assert.Equal(SyntaxKind.AwaitExpression, right.Kind)
End Sub
<Fact>
Public Sub ParseAwaitStatements()
Dim tree = ParseAndVerify(<![CDATA[
Imports System.Console
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Async Sub M()
' await 1
Await t1
End Sub
Sub M2()
' await 2
Await t1
Dim lambda = Async Sub() If True Then Await t1 : Await t2 ' await 3 and 4
End Sub
Async Function N() As Task(Of Integer)
' await 5
Await t1
' await 6
Return Await t2
End Function
Function N2()
Await t1
Return (Await t2)
End Function
Async Function N3(a, x, y) As Task
' This is a parse error, end of statement expected after 'Await a'
Await a * Await x * Await y
End Function
End Module]]>,
<errors>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="177" end="179"/>
<error id="30800" message="Method arguments must be enclosed in parentheses." start="407" end="409"/>
<error id="30198" message="')' expected." start="433" end="433"/>
<error id="30205" message="End of statement expected." start="588" end="589"/>
</errors>)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax)().ToArray()
Assert.Equal(6, awaitExpressions.Count)
Dim firstStatementOfM = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfM2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(firstStatementOfM, ExpressionStatementSyntax).Expression.Kind)
Dim firstStatementOfN2 = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
Assert.Equal(SyntaxKind.ExpressionStatement, firstStatementOfM2.Kind)
Assert.Equal(SyntaxKind.InvocationExpression, CType(firstStatementOfM2, ExpressionStatementSyntax).Expression.Kind)
End Sub
<Fact>
Public Sub ParseAsyncLambdas()
Dim tree = ParseAndVerify(<![CDATA[
Module Program
Private t1 As Task
Private t2 As Task(Of Integer)
Private f As Integer
Sub Main()
' Statement
Dim slAsyncSub1 = Async Sub() Await t1
' Assignment
Dim slAsyncSub2 = Async Sub() f = Await t2
' Expression
Dim slAsyncFunction1 = Async Function() Await t2
' Comparison
Dim slAsyncFunction2 = Async Function() f = Await t2
Dim mlAsyncSub = Async Sub()
Await t1
End Sub
Dim mlAsyncFunction1 = Async Function()
Await t1
End Function
Dim mlAsyncFunction2 = Async Function()
Await t1
Return Await t2
End Function
End Sub
End Module]]>)
Dim lambdas = tree.GetRoot().DescendantNodes.OfType(Of LambdaExpressionSyntax)().ToArray()
Assert.Equal(7, lambdas.Count)
Assert.Equal(4, lambdas.Count(Function(l) SyntaxFacts.IsSingleLineLambdaExpression(l.Kind)))
Assert.Equal(SyntaxKind.ExpressionStatement, CType(lambdas(0), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(0), SingleLineLambdaExpressionSyntax).Body, ExpressionStatementSyntax).Expression.Kind)
Assert.Equal(SyntaxKind.SimpleAssignmentStatement, CType(lambdas(1), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(1), SingleLineLambdaExpressionSyntax).Body, AssignmentStatementSyntax).Right.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(lambdas(2), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.EqualsExpression, CType(lambdas(3), SingleLineLambdaExpressionSyntax).Body.Kind)
Assert.Equal(SyntaxKind.AwaitExpression, CType(CType(lambdas(3), SingleLineLambdaExpressionSyntax).Body, BinaryExpressionSyntax).Right.Kind)
Assert.Equal(3, lambdas.Count(Function(l) SyntaxFacts.IsMultiLineLambdaExpression(l.Kind)))
End Sub
<Fact>
Public Sub ParseAsyncWithNesting()
Dim tree = VisualBasicSyntaxTree.ParseText(<![CDATA[
Imports Async = System.Threading.Tasks.Task
Class C
Public Const Async As Integer = 0
<Async(Async)>
Async Function M() As Async
Dim t As Task
Await (t) ' Yes
Dim lambda1 = Function() Await (t) ' No
Dim lambda1a = Sub() Await (t) ' No
Dim lambda1b = Async Function() Await t ' Yes
Dim lambda1c = Async Function()
Await (Sub()
Await (Function() Await (Function() (Function() Async Sub() Await t)())())
End Sub) ' Yes, No, No, Yes
Return Await t ' Yes
End Function
[Await] t ' No
End Function
Sub Await(Optional p = Nothing)
Dim t As Task
Await (t) ' No
Dim lambda1 = Async Function() Await (t) ' Yes
Dim lambda1a = Async Sub() Await (t) ' Yes
Dim lambda1b = Function() Await (t) ' No
Dim lambda1c = Function()
Await (Async Sub()
Await (Async Function() Await (Async Function() (Function() Sub() Await t)())())
End Sub) ' No, Yes, Yes, No
Return Await (t) ' No
End Function
Await t
End Sub
Function Await(t)
Return Nothing
End Function
End Class
Class AsyncAttribute
Inherits Attribute
Sub New(p)
End Sub
End Class]]>.Value)
' Error BC30800: Method arguments must be enclosed in parentheses.
Assert.True(Aggregate d In tree.GetDiagnostics() Into All(d.Code = ERRID.ERR_ObsoleteArgumentsNeedParens))
Dim asyncExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
Assert.Equal(9, asyncExpressions.Count)
Dim invocationExpression = tree.GetRoot().DescendantNodes.OfType(Of InvocationExpressionSyntax).ToArray()
Assert.Equal(9, asyncExpressions.Count)
Dim allParsedExpressions = tree.GetRoot().DescendantNodes.OfType(Of ExpressionSyntax)()
Dim parsedExpressions = From expression In allParsedExpressions
Where expression.Kind = SyntaxKind.AwaitExpression OrElse
(expression.Kind = SyntaxKind.IdentifierName AndAlso DirectCast(expression, IdentifierNameSyntax).Identifier.ValueText.Equals("Await"))
Order By expression.Position
Select expression.Kind
Dim expected = {SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.AwaitExpression,
SyntaxKind.AwaitExpression,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName,
SyntaxKind.IdentifierName}
Assert.Equal(expected, parsedExpressions)
End Sub
<Fact>
Public Sub ParseAwaitInScriptingAndInteractive()
Dim source = "
Dim i = Await T + Await(T) ' Yes, Yes
Dim l = Sub()
Await T ' No
End Sub
Function M()
Return Await T ' No
End Function
Async Sub N()
Await T ' Yes
Await(T) ' Yes
End Sub
Async Function F()
Return Await(T) ' Yes
End Function"
Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script)
Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
Assert.Equal(5, awaitExpressions.Count)
Dim awaitParsedAsIdentifier = tree.GetRoot().DescendantNodes.OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText.Equals("Await")).ToArray()
Assert.Equal(2, awaitParsedAsIdentifier.Count)
End Sub
End Class
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Analyzers/VisualBasic/Analyzers/UseCollectionInitializer/VisualBasicUseCollectionInitializerDiagnosticAnalyzer.vb | ' 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.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.UseCollectionInitializer
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UseCollectionInitializer
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicUseCollectionInitializerDiagnosticAnalyzer
Inherits AbstractUseCollectionInitializerDiagnosticAnalyzer(Of
SyntaxKind,
ExpressionSyntax,
StatementSyntax,
ObjectCreationExpressionSyntax,
MemberAccessExpressionSyntax,
InvocationExpressionSyntax,
ExpressionStatementSyntax,
VariableDeclaratorSyntax)
Protected Overrides Function AreCollectionInitializersSupported(compilation As Compilation) As Boolean
Return True
End Function
Protected Overrides Function GetSyntaxFacts() As ISyntaxFacts
Return VisualBasicSyntaxFacts.Instance
End Function
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.UseCollectionInitializer
Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UseCollectionInitializer
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicUseCollectionInitializerDiagnosticAnalyzer
Inherits AbstractUseCollectionInitializerDiagnosticAnalyzer(Of
SyntaxKind,
ExpressionSyntax,
StatementSyntax,
ObjectCreationExpressionSyntax,
MemberAccessExpressionSyntax,
InvocationExpressionSyntax,
ExpressionStatementSyntax,
VariableDeclaratorSyntax)
Protected Overrides Function AreCollectionInitializersSupported(compilation As Compilation) As Boolean
Return True
End Function
Protected Overrides Function GetSyntaxFacts() As ISyntaxFacts
Return VisualBasicSyntaxFacts.Instance
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/VisualBasic/Portable/Symbols/AnonymousTypes/SynthesizedSymbols/AnonymousType_PropertyAccessors.vb | ' 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.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Partial Friend NotInheritable Class AnonymousTypeManager
Private MustInherit Class AnonymousTypePropertyAccessorSymbol
Inherits SynthesizedPropertyAccessorBase(Of PropertySymbol)
Private ReadOnly _returnType As TypeSymbol
Public Sub New([property] As PropertySymbol, returnType As TypeSymbol)
MyBase.New([property].ContainingType, [property])
_returnType = returnType
End Sub
Friend NotOverridable Overrides ReadOnly Property BackingFieldSymbol As FieldSymbol
Get
Return DirectCast(Me.m_propertyOrEvent, AnonymousTypePropertySymbol).AssociatedField
End Get
End Property
Protected Overrides Function GenerateMetadataName() As String
Return Binder.GetAccessorName(m_propertyOrEvent.MetadataName, Me.MethodKind, Me.IsCompilationOutputWinMdObj())
End Function
Public Overrides ReadOnly Property ReturnType As TypeSymbol
Get
Return _returnType
End Get
End Property
Friend Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
MyBase.AddSynthesizedAttributes(compilationState, attributes)
' Dev11 adds DebuggerNonUserCode; there is no reason to do so since:
' - we emit no debug info for the body
' - the code doesn't call any user code that could inspect the stack and find the accessor's frame
' - the code doesn't throw exceptions whose stack frames we would need to hide
'
' C# also doesn't add DebuggerHidden nor DebuggerNonUserCode attributes.
End Sub
Friend NotOverridable Overrides ReadOnly Property GenerateDebugInfoImpl As Boolean
Get
Return False
End Get
End Property
Friend NotOverridable Overrides Function CalculateLocalSyntaxOffset(localPosition As Integer, localTree As SyntaxTree) As Integer
Throw ExceptionUtilities.Unreachable
End Function
End Class
Private NotInheritable Class AnonymousTypePropertyGetAccessorSymbol
Inherits AnonymousTypePropertyAccessorSymbol
Public Sub New([property] As PropertySymbol)
MyBase.New([property], [property].Type)
End Sub
Public Overrides ReadOnly Property IsSub As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property MethodKind As MethodKind
Get
Return MethodKind.PropertyGet
End Get
End Property
End Class
Private NotInheritable Class AnonymousTypePropertySetAccessorSymbol
Inherits AnonymousTypePropertyAccessorSymbol
Private _parameters As ImmutableArray(Of ParameterSymbol)
Public Sub New([property] As PropertySymbol, voidTypeSymbol As TypeSymbol)
MyBase.New([property], voidTypeSymbol)
_parameters = ImmutableArray.Create(Of ParameterSymbol)(
New SynthesizedParameterSymbol(Me, m_propertyOrEvent.Type, 0, False, StringConstants.ValueParameterName))
End Sub
Public Overrides ReadOnly Property IsSub As Boolean
Get
Return True
End Get
End Property
Public Overrides ReadOnly Property Parameters As ImmutableArray(Of ParameterSymbol)
Get
Return _parameters
End Get
End Property
Public Overrides ReadOnly Property MethodKind As MethodKind
Get
Return MethodKind.PropertySet
End Get
End Property
End Class
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Partial Friend NotInheritable Class AnonymousTypeManager
Private MustInherit Class AnonymousTypePropertyAccessorSymbol
Inherits SynthesizedPropertyAccessorBase(Of PropertySymbol)
Private ReadOnly _returnType As TypeSymbol
Public Sub New([property] As PropertySymbol, returnType As TypeSymbol)
MyBase.New([property].ContainingType, [property])
_returnType = returnType
End Sub
Friend NotOverridable Overrides ReadOnly Property BackingFieldSymbol As FieldSymbol
Get
Return DirectCast(Me.m_propertyOrEvent, AnonymousTypePropertySymbol).AssociatedField
End Get
End Property
Protected Overrides Function GenerateMetadataName() As String
Return Binder.GetAccessorName(m_propertyOrEvent.MetadataName, Me.MethodKind, Me.IsCompilationOutputWinMdObj())
End Function
Public Overrides ReadOnly Property ReturnType As TypeSymbol
Get
Return _returnType
End Get
End Property
Friend Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
MyBase.AddSynthesizedAttributes(compilationState, attributes)
' Dev11 adds DebuggerNonUserCode; there is no reason to do so since:
' - we emit no debug info for the body
' - the code doesn't call any user code that could inspect the stack and find the accessor's frame
' - the code doesn't throw exceptions whose stack frames we would need to hide
'
' C# also doesn't add DebuggerHidden nor DebuggerNonUserCode attributes.
End Sub
Friend NotOverridable Overrides ReadOnly Property GenerateDebugInfoImpl As Boolean
Get
Return False
End Get
End Property
Friend NotOverridable Overrides Function CalculateLocalSyntaxOffset(localPosition As Integer, localTree As SyntaxTree) As Integer
Throw ExceptionUtilities.Unreachable
End Function
End Class
Private NotInheritable Class AnonymousTypePropertyGetAccessorSymbol
Inherits AnonymousTypePropertyAccessorSymbol
Public Sub New([property] As PropertySymbol)
MyBase.New([property], [property].Type)
End Sub
Public Overrides ReadOnly Property IsSub As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property MethodKind As MethodKind
Get
Return MethodKind.PropertyGet
End Get
End Property
End Class
Private NotInheritable Class AnonymousTypePropertySetAccessorSymbol
Inherits AnonymousTypePropertyAccessorSymbol
Private _parameters As ImmutableArray(Of ParameterSymbol)
Public Sub New([property] As PropertySymbol, voidTypeSymbol As TypeSymbol)
MyBase.New([property], voidTypeSymbol)
_parameters = ImmutableArray.Create(Of ParameterSymbol)(
New SynthesizedParameterSymbol(Me, m_propertyOrEvent.Type, 0, False, StringConstants.ValueParameterName))
End Sub
Public Overrides ReadOnly Property IsSub As Boolean
Get
Return True
End Get
End Property
Public Overrides ReadOnly Property Parameters As ImmutableArray(Of ParameterSymbol)
Get
Return _parameters
End Get
End Property
Public Overrides ReadOnly Property MethodKind As MethodKind
Get
Return MethodKind.PropertySet
End Get
End Property
End Class
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_DateAndTime.vb | ' 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.
Imports System.Globalization
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<[UseExportProvider]>
Public Class CSharpCompletionCommandHandlerTests_DateAndTime
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsShownWithDefaultFormatStringAfterTypingFirstQuote(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString($$);
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("""")
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString(""G)", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsNotShownAfterTypingEndingQuote(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString(" $$);
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("""")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsShownWithDefaultFormatStringAfterTypingFormattingComponentColon(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars(":")
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:G}"";", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsNotShownAfterTypingColonWithinFormattingComponent(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:hh$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars(":")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString(""G"")", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString(":ff$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString("":FF"")", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("f$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("hh:mm:$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestNullableDateTimeCompletion(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime? d)
{
d?.ToString("hh:mm:$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:G}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = @$""Text {d:G}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:ff$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:FF}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:ff$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = @$""Text {d:FF}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $@"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:hh:mm:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:hh:mm:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {date:f$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {date:f$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
End Class
End Namespace
| ' 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.
Imports System.Globalization
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<[UseExportProvider]>
Public Class CSharpCompletionCommandHandlerTests_DateAndTime
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsShownWithDefaultFormatStringAfterTypingFirstQuote(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString($$);
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("""")
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString(""G)", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsNotShownAfterTypingEndingQuote(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString(" $$);
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("""")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsShownWithDefaultFormatStringAfterTypingFormattingComponentColon(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars(":")
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:G}"";", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function CompletionListIsNotShownAfterTypingColonWithinFormattingComponent(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:hh$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars(":")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString(""G"")", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString(":ff$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("d.ToString("":FF"")", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("f$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
d.ToString("hh:mm:$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestNullableDateTimeCompletion(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime? d)
{
d?.ToString("hh:mm:$$");
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:G}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("G", inlineDescription:=FeaturesResources.general_long_date_time)
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = @$""Text {d:G}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:ff$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = $""Text {d:FF}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function ExplicitInvoke_OverwriteExisting_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:ff$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
Await state.AssertSelectedCompletionItem("ff")
state.SendDownKey()
Await state.AssertSelectedCompletionItem("FF")
state.SendTab()
Await state.AssertNoCompletionSession()
Assert.Contains("_ = @$""Text {d:FF}""", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_BeginningOfWord_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $@"Text {d:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertCompletionSession()
Await state.AssertSelectedCompletionItem("f")
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {d:hh:mm:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestExample1_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {d:hh:mm:$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendInvokeCompletionList()
state.SendTypeChars("ss")
Await state.AssertSelectedCompletionItem("ss", inlineDescription:=FeaturesResources.second_2_digits)
Dim description = Await state.GetSelectedItemDescriptionAsync()
Dim text = description.Text
If CultureInfo.CurrentCulture.Name <> "en-US" Then
Assert.Contains($"hh:mm:ss (en-US) → 01:45:30", text)
Assert.Contains($"hh:mm:ss ({CultureInfo.CurrentCulture.Name}) → 01:45:30", text)
Else
Assert.Contains("hh:mm:ss → 01:45:30", text)
End If
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord_StringInterpolation1(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = $"Text {date:f$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TypeChar_MiddleOfWord_StringInterpolation2(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
class c
{
void goo(DateTime d)
{
_ = @$"Text {date:f$$}";
}
}
]]></Document>, showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("f")
Await state.AssertNoCompletionSession()
End Using
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/Core/Portable/ExternalAccess/UnitTesting/Api/UnitTestingSymbolExtensions.cs | // 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.Threading;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
internal static class UnitTestingSymbolExtensions
{
public static string GetSymbolKeyString(this ISymbol symbol, CancellationToken cancellationToken)
=> SymbolKey.Create(symbol, cancellationToken).ToString();
}
}
| // 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.Threading;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
internal static class UnitTestingSymbolExtensions
{
public static string GetSymbolKeyString(this ISymbol symbol, CancellationToken cancellationToken)
=> SymbolKey.Create(symbol, cancellationToken).ToString();
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Workspaces/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs | // 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.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Runtime.CompilerServices;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal sealed class HostDiagnosticAnalyzers
{
/// <summary>
/// Key is <see cref="AnalyzerReference.Id"/>.
///
/// We use the key to de-duplicate analyzer references if they are referenced from multiple places.
/// </summary>
private readonly ImmutableDictionary<object, AnalyzerReference> _hostAnalyzerReferencesMap;
/// <summary>
/// Key is the language the <see cref="DiagnosticAnalyzer"/> supports and key for the second map is analyzer reference identity and
/// <see cref="DiagnosticAnalyzer"/> for that assembly reference.
///
/// Entry will be lazily filled in.
/// </summary>
private readonly ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _hostDiagnosticAnalyzersPerLanguageMap;
/// <summary>
/// Key is <see cref="AnalyzerReference.Id"/>.
///
/// Value is set of <see cref="DiagnosticAnalyzer"/> that belong to the <see cref="AnalyzerReference"/>.
///
/// We populate it lazily. otherwise, we will bring in all analyzers preemptively
/// </summary>
private readonly Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _lazyHostDiagnosticAnalyzersPerReferenceMap;
/// <summary>
/// Maps <see cref="LanguageNames"/> to compiler diagnostic analyzers.
/// </summary>
private ImmutableDictionary<string, DiagnosticAnalyzer> _compilerDiagnosticAnalyzerMap;
/// <summary>
/// Maps list of analyzer references and <see cref="LanguageNames"/> to <see cref="SkippedHostAnalyzersInfo"/>.
/// </summary>
/// <remarks>
/// TODO: https://github.com/dotnet/roslyn/issues/42848
/// It is quite common for multiple projects to have the same set of analyzer references, yet we will create
/// multiple instances of the analyzer list and thus not share the info.
/// </remarks>
private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>> _skippedHostAnalyzers;
internal HostDiagnosticAnalyzers(IEnumerable<AnalyzerReference> hostAnalyzerReferences)
{
_hostAnalyzerReferencesMap = CreateAnalyzerReferencesMap(hostAnalyzerReferences);
_hostDiagnosticAnalyzersPerLanguageMap = new ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(concurrencyLevel: 2, capacity: 2);
_lazyHostDiagnosticAnalyzersPerReferenceMap = new Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(() => CreateDiagnosticAnalyzersPerReferenceMap(_hostAnalyzerReferencesMap), isThreadSafe: true);
_compilerDiagnosticAnalyzerMap = ImmutableDictionary<string, DiagnosticAnalyzer>.Empty;
_skippedHostAnalyzers = new ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>>();
}
/// <summary>
/// It returns a map with <see cref="AnalyzerReference.Id"/> as key and <see cref="AnalyzerReference"/> as value
/// </summary>
public ImmutableDictionary<object, AnalyzerReference> GetHostAnalyzerReferencesMap()
=> _hostAnalyzerReferencesMap;
/// <summary>
/// Get <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="language"/>
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> GetOrCreateHostDiagnosticAnalyzersPerReference(string language)
=> _hostDiagnosticAnalyzersPerLanguageMap.GetOrAdd(language, CreateHostDiagnosticAnalyzersAndBuildMap);
public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache)
{
return ConvertReferenceIdentityToName(
CreateDiagnosticDescriptorsPerReference(infoCache, _lazyHostDiagnosticAnalyzersPerReferenceMap.Value),
_hostAnalyzerReferencesMap);
}
public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache, Project project)
{
var descriptorPerReference = CreateDiagnosticDescriptorsPerReference(infoCache, CreateDiagnosticAnalyzersPerReference(project));
var map = _hostAnalyzerReferencesMap.AddRange(CreateProjectAnalyzerReferencesMap(project.AnalyzerReferences));
return ConvertReferenceIdentityToName(descriptorPerReference, map);
}
private static ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> ConvertReferenceIdentityToName(
ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> descriptorsPerReference,
ImmutableDictionary<object, AnalyzerReference> map)
{
var builder = ImmutableDictionary.CreateBuilder<string, ImmutableArray<DiagnosticDescriptor>>();
foreach (var (id, descriptors) in descriptorsPerReference)
{
if (!map.TryGetValue(id, out var reference) || reference == null)
{
continue;
}
var displayName = reference.Display ?? WorkspacesResources.Unknown;
// if there are duplicates, merge descriptors
if (builder.TryGetValue(displayName, out var existing))
{
builder[displayName] = existing.AddRange(descriptors);
continue;
}
builder.Add(displayName, descriptors);
}
return builder.ToImmutable();
}
/// <summary>
/// Create <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="project"/> that
/// includes both host and project analyzers
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReference(Project project)
{
var hostAnalyzerReferences = GetOrCreateHostDiagnosticAnalyzersPerReference(project.Language);
var projectAnalyzerReferences = CreateProjectDiagnosticAnalyzersPerReference(project.AnalyzerReferences, project.Language);
return MergeDiagnosticAnalyzerMap(hostAnalyzerReferences, projectAnalyzerReferences);
}
/// <summary>
/// Create <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="project"/> that
/// has only project analyzers
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(Project project)
=> CreateProjectDiagnosticAnalyzersPerReference(project.AnalyzerReferences, project.Language);
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences, string language)
=> CreateDiagnosticAnalyzersPerReferenceMap(CreateProjectAnalyzerReferencesMap(projectAnalyzerReferences), language);
/// <summary>
/// Return compiler <see cref="DiagnosticAnalyzer"/> for the given language.
/// </summary>
public DiagnosticAnalyzer? GetCompilerDiagnosticAnalyzer(string language)
{
_ = GetOrCreateHostDiagnosticAnalyzersPerReference(language);
if (_compilerDiagnosticAnalyzerMap.TryGetValue(language, out var compilerAnalyzer))
{
return compilerAnalyzer;
}
return null;
}
private ImmutableDictionary<object, AnalyzerReference> CreateProjectAnalyzerReferencesMap(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences)
=> CreateAnalyzerReferencesMap(projectAnalyzerReferences.Where(reference => !_hostAnalyzerReferencesMap.ContainsKey(reference.Id)));
private static ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> CreateDiagnosticDescriptorsPerReference(
DiagnosticAnalyzerInfoCache infoCache,
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> analyzersMap)
{
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticDescriptor>>();
foreach (var (referenceId, analyzers) in analyzersMap)
{
var descriptors = ImmutableArray.CreateBuilder<DiagnosticDescriptor>();
foreach (var analyzer in analyzers)
{
// given map should be in good shape. no duplication. no null and etc
descriptors.AddRange(infoCache.GetDiagnosticDescriptors(analyzer));
}
// there can't be duplication since _hostAnalyzerReferenceMap is already de-duplicated.
builder.Add(referenceId, descriptors.ToImmutable());
}
return builder.ToImmutable();
}
private ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateHostDiagnosticAnalyzersAndBuildMap(string language)
{
Contract.ThrowIfNull(language);
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticAnalyzer>>();
foreach (var (referenceIdentity, reference) in _hostAnalyzerReferencesMap)
{
var analyzers = reference.GetAnalyzers(language);
if (analyzers.Length == 0)
{
continue;
}
UpdateCompilerAnalyzerMapIfNeeded(language, analyzers);
// there can't be duplication since _hostAnalyzerReferenceMap is already de-duplicated.
builder.Add(referenceIdentity, analyzers);
}
return builder.ToImmutable();
}
private void UpdateCompilerAnalyzerMapIfNeeded(string language, ImmutableArray<DiagnosticAnalyzer> analyzers)
{
if (_compilerDiagnosticAnalyzerMap.ContainsKey(language))
{
return;
}
foreach (var analyzer in analyzers)
{
if (analyzer.IsCompilerAnalyzer())
{
ImmutableInterlocked.GetOrAdd(ref _compilerDiagnosticAnalyzerMap, language, analyzer);
return;
}
}
}
private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReferenceMap(
IDictionary<object, AnalyzerReference> analyzerReferencesMap, string? language = null)
{
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticAnalyzer>>();
foreach (var reference in analyzerReferencesMap)
{
var analyzers = language == null ? reference.Value.GetAnalyzersForAllLanguages() : reference.Value.GetAnalyzers(language);
if (analyzers.Length == 0)
{
continue;
}
// input "analyzerReferencesMap" is a dictionary, so there will be no duplication here.
builder.Add(reference.Key, analyzers.WhereNotNull().ToImmutableArray());
}
return builder.ToImmutable();
}
private static ImmutableDictionary<object, AnalyzerReference> CreateAnalyzerReferencesMap(IEnumerable<AnalyzerReference> analyzerReferences)
{
var builder = ImmutableDictionary.CreateBuilder<object, AnalyzerReference>();
foreach (var reference in analyzerReferences)
{
var key = reference.Id;
// filter out duplicated analyzer reference
if (builder.ContainsKey(key))
{
continue;
}
builder.Add(key, reference);
}
return builder.ToImmutable();
}
private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> MergeDiagnosticAnalyzerMap(
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map1,
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map2)
{
var current = map1;
var seen = new HashSet<DiagnosticAnalyzer>(map1.Values.SelectMany(v => v));
foreach (var (referenceIdentity, analyzers) in map2)
{
if (map1.ContainsKey(referenceIdentity))
{
continue;
}
current = current.Add(referenceIdentity, analyzers.Where(a => seen.Add(a)).ToImmutableArray());
}
return current;
}
public SkippedHostAnalyzersInfo GetSkippedAnalyzersInfo(Project project, DiagnosticAnalyzerInfoCache infoCache)
{
var box = _skippedHostAnalyzers.GetOrCreateValue(project.AnalyzerReferences);
if (box.Value != null && box.Value.TryGetValue(project.Language, out var info))
{
return info;
}
lock (box)
{
box.Value ??= ImmutableDictionary<string, SkippedHostAnalyzersInfo>.Empty;
if (!box.Value.TryGetValue(project.Language, out info))
{
info = SkippedHostAnalyzersInfo.Create(this, project.AnalyzerReferences, project.Language, infoCache);
box.Value = box.Value.Add(project.Language, info);
}
return info;
}
}
}
}
| // 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.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Runtime.CompilerServices;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal sealed class HostDiagnosticAnalyzers
{
/// <summary>
/// Key is <see cref="AnalyzerReference.Id"/>.
///
/// We use the key to de-duplicate analyzer references if they are referenced from multiple places.
/// </summary>
private readonly ImmutableDictionary<object, AnalyzerReference> _hostAnalyzerReferencesMap;
/// <summary>
/// Key is the language the <see cref="DiagnosticAnalyzer"/> supports and key for the second map is analyzer reference identity and
/// <see cref="DiagnosticAnalyzer"/> for that assembly reference.
///
/// Entry will be lazily filled in.
/// </summary>
private readonly ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _hostDiagnosticAnalyzersPerLanguageMap;
/// <summary>
/// Key is <see cref="AnalyzerReference.Id"/>.
///
/// Value is set of <see cref="DiagnosticAnalyzer"/> that belong to the <see cref="AnalyzerReference"/>.
///
/// We populate it lazily. otherwise, we will bring in all analyzers preemptively
/// </summary>
private readonly Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _lazyHostDiagnosticAnalyzersPerReferenceMap;
/// <summary>
/// Maps <see cref="LanguageNames"/> to compiler diagnostic analyzers.
/// </summary>
private ImmutableDictionary<string, DiagnosticAnalyzer> _compilerDiagnosticAnalyzerMap;
/// <summary>
/// Maps list of analyzer references and <see cref="LanguageNames"/> to <see cref="SkippedHostAnalyzersInfo"/>.
/// </summary>
/// <remarks>
/// TODO: https://github.com/dotnet/roslyn/issues/42848
/// It is quite common for multiple projects to have the same set of analyzer references, yet we will create
/// multiple instances of the analyzer list and thus not share the info.
/// </remarks>
private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>> _skippedHostAnalyzers;
internal HostDiagnosticAnalyzers(IEnumerable<AnalyzerReference> hostAnalyzerReferences)
{
_hostAnalyzerReferencesMap = CreateAnalyzerReferencesMap(hostAnalyzerReferences);
_hostDiagnosticAnalyzersPerLanguageMap = new ConcurrentDictionary<string, ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(concurrencyLevel: 2, capacity: 2);
_lazyHostDiagnosticAnalyzersPerReferenceMap = new Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(() => CreateDiagnosticAnalyzersPerReferenceMap(_hostAnalyzerReferencesMap), isThreadSafe: true);
_compilerDiagnosticAnalyzerMap = ImmutableDictionary<string, DiagnosticAnalyzer>.Empty;
_skippedHostAnalyzers = new ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>>();
}
/// <summary>
/// It returns a map with <see cref="AnalyzerReference.Id"/> as key and <see cref="AnalyzerReference"/> as value
/// </summary>
public ImmutableDictionary<object, AnalyzerReference> GetHostAnalyzerReferencesMap()
=> _hostAnalyzerReferencesMap;
/// <summary>
/// Get <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="language"/>
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> GetOrCreateHostDiagnosticAnalyzersPerReference(string language)
=> _hostDiagnosticAnalyzersPerLanguageMap.GetOrAdd(language, CreateHostDiagnosticAnalyzersAndBuildMap);
public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache)
{
return ConvertReferenceIdentityToName(
CreateDiagnosticDescriptorsPerReference(infoCache, _lazyHostDiagnosticAnalyzersPerReferenceMap.Value),
_hostAnalyzerReferencesMap);
}
public ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptorsPerReference(DiagnosticAnalyzerInfoCache infoCache, Project project)
{
var descriptorPerReference = CreateDiagnosticDescriptorsPerReference(infoCache, CreateDiagnosticAnalyzersPerReference(project));
var map = _hostAnalyzerReferencesMap.AddRange(CreateProjectAnalyzerReferencesMap(project.AnalyzerReferences));
return ConvertReferenceIdentityToName(descriptorPerReference, map);
}
private static ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> ConvertReferenceIdentityToName(
ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> descriptorsPerReference,
ImmutableDictionary<object, AnalyzerReference> map)
{
var builder = ImmutableDictionary.CreateBuilder<string, ImmutableArray<DiagnosticDescriptor>>();
foreach (var (id, descriptors) in descriptorsPerReference)
{
if (!map.TryGetValue(id, out var reference) || reference == null)
{
continue;
}
var displayName = reference.Display ?? WorkspacesResources.Unknown;
// if there are duplicates, merge descriptors
if (builder.TryGetValue(displayName, out var existing))
{
builder[displayName] = existing.AddRange(descriptors);
continue;
}
builder.Add(displayName, descriptors);
}
return builder.ToImmutable();
}
/// <summary>
/// Create <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="project"/> that
/// includes both host and project analyzers
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReference(Project project)
{
var hostAnalyzerReferences = GetOrCreateHostDiagnosticAnalyzersPerReference(project.Language);
var projectAnalyzerReferences = CreateProjectDiagnosticAnalyzersPerReference(project.AnalyzerReferences, project.Language);
return MergeDiagnosticAnalyzerMap(hostAnalyzerReferences, projectAnalyzerReferences);
}
/// <summary>
/// Create <see cref="AnalyzerReference"/> identity and <see cref="DiagnosticAnalyzer"/>s map for given <paramref name="project"/> that
/// has only project analyzers
/// </summary>
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(Project project)
=> CreateProjectDiagnosticAnalyzersPerReference(project.AnalyzerReferences, project.Language);
public ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateProjectDiagnosticAnalyzersPerReference(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences, string language)
=> CreateDiagnosticAnalyzersPerReferenceMap(CreateProjectAnalyzerReferencesMap(projectAnalyzerReferences), language);
/// <summary>
/// Return compiler <see cref="DiagnosticAnalyzer"/> for the given language.
/// </summary>
public DiagnosticAnalyzer? GetCompilerDiagnosticAnalyzer(string language)
{
_ = GetOrCreateHostDiagnosticAnalyzersPerReference(language);
if (_compilerDiagnosticAnalyzerMap.TryGetValue(language, out var compilerAnalyzer))
{
return compilerAnalyzer;
}
return null;
}
private ImmutableDictionary<object, AnalyzerReference> CreateProjectAnalyzerReferencesMap(IReadOnlyList<AnalyzerReference> projectAnalyzerReferences)
=> CreateAnalyzerReferencesMap(projectAnalyzerReferences.Where(reference => !_hostAnalyzerReferencesMap.ContainsKey(reference.Id)));
private static ImmutableDictionary<object, ImmutableArray<DiagnosticDescriptor>> CreateDiagnosticDescriptorsPerReference(
DiagnosticAnalyzerInfoCache infoCache,
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> analyzersMap)
{
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticDescriptor>>();
foreach (var (referenceId, analyzers) in analyzersMap)
{
var descriptors = ImmutableArray.CreateBuilder<DiagnosticDescriptor>();
foreach (var analyzer in analyzers)
{
// given map should be in good shape. no duplication. no null and etc
descriptors.AddRange(infoCache.GetDiagnosticDescriptors(analyzer));
}
// there can't be duplication since _hostAnalyzerReferenceMap is already de-duplicated.
builder.Add(referenceId, descriptors.ToImmutable());
}
return builder.ToImmutable();
}
private ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateHostDiagnosticAnalyzersAndBuildMap(string language)
{
Contract.ThrowIfNull(language);
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticAnalyzer>>();
foreach (var (referenceIdentity, reference) in _hostAnalyzerReferencesMap)
{
var analyzers = reference.GetAnalyzers(language);
if (analyzers.Length == 0)
{
continue;
}
UpdateCompilerAnalyzerMapIfNeeded(language, analyzers);
// there can't be duplication since _hostAnalyzerReferenceMap is already de-duplicated.
builder.Add(referenceIdentity, analyzers);
}
return builder.ToImmutable();
}
private void UpdateCompilerAnalyzerMapIfNeeded(string language, ImmutableArray<DiagnosticAnalyzer> analyzers)
{
if (_compilerDiagnosticAnalyzerMap.ContainsKey(language))
{
return;
}
foreach (var analyzer in analyzers)
{
if (analyzer.IsCompilerAnalyzer())
{
ImmutableInterlocked.GetOrAdd(ref _compilerDiagnosticAnalyzerMap, language, analyzer);
return;
}
}
}
private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> CreateDiagnosticAnalyzersPerReferenceMap(
IDictionary<object, AnalyzerReference> analyzerReferencesMap, string? language = null)
{
var builder = ImmutableDictionary.CreateBuilder<object, ImmutableArray<DiagnosticAnalyzer>>();
foreach (var reference in analyzerReferencesMap)
{
var analyzers = language == null ? reference.Value.GetAnalyzersForAllLanguages() : reference.Value.GetAnalyzers(language);
if (analyzers.Length == 0)
{
continue;
}
// input "analyzerReferencesMap" is a dictionary, so there will be no duplication here.
builder.Add(reference.Key, analyzers.WhereNotNull().ToImmutableArray());
}
return builder.ToImmutable();
}
private static ImmutableDictionary<object, AnalyzerReference> CreateAnalyzerReferencesMap(IEnumerable<AnalyzerReference> analyzerReferences)
{
var builder = ImmutableDictionary.CreateBuilder<object, AnalyzerReference>();
foreach (var reference in analyzerReferences)
{
var key = reference.Id;
// filter out duplicated analyzer reference
if (builder.ContainsKey(key))
{
continue;
}
builder.Add(key, reference);
}
return builder.ToImmutable();
}
private static ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> MergeDiagnosticAnalyzerMap(
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map1,
ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>> map2)
{
var current = map1;
var seen = new HashSet<DiagnosticAnalyzer>(map1.Values.SelectMany(v => v));
foreach (var (referenceIdentity, analyzers) in map2)
{
if (map1.ContainsKey(referenceIdentity))
{
continue;
}
current = current.Add(referenceIdentity, analyzers.Where(a => seen.Add(a)).ToImmutableArray());
}
return current;
}
public SkippedHostAnalyzersInfo GetSkippedAnalyzersInfo(Project project, DiagnosticAnalyzerInfoCache infoCache)
{
var box = _skippedHostAnalyzers.GetOrCreateValue(project.AnalyzerReferences);
if (box.Value != null && box.Value.TryGetValue(project.Language, out var info))
{
return info;
}
lock (box)
{
box.Value ??= ImmutableDictionary<string, SkippedHostAnalyzersInfo>.Empty;
if (!box.Value.TryGetValue(project.Language, out info))
{
info = SkippedHostAnalyzersInfo.Create(this, project.AnalyzerReferences, project.Language, infoCache);
box.Value = box.Value.Add(project.Language, info);
}
return info;
}
}
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/CSharp/Portable/Syntax/BlockSyntax.cs | // 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 Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
public partial class BlockSyntax
{
public BlockSyntax Update(SyntaxToken openBraceToken, SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
=> Update(AttributeLists, openBraceToken, statements, closeBraceToken);
}
}
namespace Microsoft.CodeAnalysis.CSharp
{
public partial class SyntaxFactory
{
public static BlockSyntax Block(SyntaxToken openBraceToken, SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
=> Block(attributeLists: default, openBraceToken, statements, closeBraceToken);
}
}
| // 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 Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
public partial class BlockSyntax
{
public BlockSyntax Update(SyntaxToken openBraceToken, SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
=> Update(AttributeLists, openBraceToken, statements, closeBraceToken);
}
}
namespace Microsoft.CodeAnalysis.CSharp
{
public partial class SyntaxFactory
{
public static BlockSyntax Block(SyntaxToken openBraceToken, SyntaxList<StatementSyntax> statements, SyntaxToken closeBraceToken)
=> Block(attributeLists: default, openBraceToken, statements, closeBraceToken);
}
}
| -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Tools/ExternalAccess/FSharp/xlf/ExternalAccessFSharpResources.ko.xlf | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ko" original="../ExternalAccessFSharpResources.resx">
<body>
<trans-unit id="AddAssemblyReference">
<source>Add an assembly reference to '{0}'</source>
<target state="translated">'{0}'에 어셈블리 참조 추가</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source>
<target state="translated">'new' 키워드 추가</target>
<note />
</trans-unit>
<trans-unit id="AddProjectReference">
<source>Add a project reference to '{0}'</source>
<target state="translated">'{0}'에 프로젝트 참조 추가</target>
<note />
</trans-unit>
<trans-unit id="CannotDetermineSymbol">
<source>Cannot determine the symbol under the caret</source>
<target state="translated">캐럿에서 기호를 확인할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="CannotNavigateUnknown">
<source>Cannot navigate to the requested location</source>
<target state="translated">요청한 위치로 이동할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="ExceptionsHeader">
<source>Exceptions:</source>
<target state="translated">예외:</target>
<note />
</trans-unit>
<trans-unit id="FSharpDisposablesClassificationType">
<source>F# Disposable Types</source>
<target state="translated">F# 삭제 가능한 형식</target>
<note />
</trans-unit>
<trans-unit id="FSharpFunctionsOrMethodsClassificationType">
<source>F# Functions / Methods</source>
<target state="translated">F# 함수/메서드</target>
<note />
</trans-unit>
<trans-unit id="FSharpMutableVarsClassificationType">
<source>F# Mutable Variables / Reference Cells</source>
<target state="translated">F# 변경 가능한 변수/참조 셀</target>
<note />
</trans-unit>
<trans-unit id="FSharpPrintfFormatClassificationType">
<source>F# Printf Format</source>
<target state="translated">F# Printf 형식</target>
<note />
</trans-unit>
<trans-unit id="FSharpPropertiesClassificationType">
<source>F# Properties</source>
<target state="translated">F# 속성</target>
<note />
</trans-unit>
<trans-unit id="GenericParametersHeader">
<source>Generic parameters:</source>
<target state="translated">제네릭 매개 변수:</target>
<note />
</trans-unit>
<trans-unit id="ImplementInterface">
<source>Implement interface</source>
<target state="translated">인터페이스 구현</target>
<note />
</trans-unit>
<trans-unit id="ImplementInterfaceWithoutTypeAnnotation">
<source>Implement interface without type annotation</source>
<target state="translated">형식 주석 없이 인터페이스 구현</target>
<note />
</trans-unit>
<trans-unit id="LocatingSymbol">
<source>Locating the symbol under the caret...</source>
<target state="translated">캐럿에서 기호를 찾는 중...</target>
<note />
</trans-unit>
<trans-unit id="NameCanBeSimplified">
<source>Name can be simplified.</source>
<target state="translated">이름을 간단하게 줄일 수 있습니다.</target>
<note />
</trans-unit>
<trans-unit id="NavigateToFailed">
<source>Navigate to symbol failed: {0}</source>
<target state="translated">기호로 이동하지 못함: {0}</target>
<note />
</trans-unit>
<trans-unit id="NavigatingTo">
<source>Navigating to symbol...</source>
<target state="translated">기호로 이동하는 중...</target>
<note />
</trans-unit>
<trans-unit id="PrefixValueNameWithUnderscore">
<source>Prefix '{0}' with underscore</source>
<target state="translated">'{0}' 앞에 밑줄 붙이기</target>
<note />
</trans-unit>
<trans-unit id="RemoveUnusedOpens">
<source>Remove unused open declarations</source>
<target state="translated">사용되지 않는 열려 있는 선언 제거</target>
<note />
</trans-unit>
<trans-unit id="RenameValueToDoubleUnderscore">
<source>Rename '{0}' to '__'</source>
<target state="translated">'{0}'에서 '__'로 이름 바꾸기</target>
<note />
</trans-unit>
<trans-unit id="RenameValueToUnderscore">
<source>Rename '{0}' to '_'</source>
<target state="translated">'{0}'에서 '_'로 이름 바꾸기</target>
<note />
</trans-unit>
<trans-unit id="SimplifyName">
<source>Simplify name</source>
<target state="translated">이름 단순화</target>
<note />
</trans-unit>
<trans-unit id="TheValueIsUnused">
<source>The value is unused</source>
<target state="translated">값이 사용되지 않음</target>
<note />
</trans-unit>
<trans-unit id="UnusedOpens">
<source>Open declaration can be removed.</source>
<target state="translated">열려 있는 선언은 제거할 수 있습니다.</target>
<note />
</trans-unit>
</body>
</file>
</xliff> | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ko" original="../ExternalAccessFSharpResources.resx">
<body>
<trans-unit id="AddAssemblyReference">
<source>Add an assembly reference to '{0}'</source>
<target state="translated">'{0}'에 어셈블리 참조 추가</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source>
<target state="translated">'new' 키워드 추가</target>
<note />
</trans-unit>
<trans-unit id="AddProjectReference">
<source>Add a project reference to '{0}'</source>
<target state="translated">'{0}'에 프로젝트 참조 추가</target>
<note />
</trans-unit>
<trans-unit id="CannotDetermineSymbol">
<source>Cannot determine the symbol under the caret</source>
<target state="translated">캐럿에서 기호를 확인할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="CannotNavigateUnknown">
<source>Cannot navigate to the requested location</source>
<target state="translated">요청한 위치로 이동할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="ExceptionsHeader">
<source>Exceptions:</source>
<target state="translated">예외:</target>
<note />
</trans-unit>
<trans-unit id="FSharpDisposablesClassificationType">
<source>F# Disposable Types</source>
<target state="translated">F# 삭제 가능한 형식</target>
<note />
</trans-unit>
<trans-unit id="FSharpFunctionsOrMethodsClassificationType">
<source>F# Functions / Methods</source>
<target state="translated">F# 함수/메서드</target>
<note />
</trans-unit>
<trans-unit id="FSharpMutableVarsClassificationType">
<source>F# Mutable Variables / Reference Cells</source>
<target state="translated">F# 변경 가능한 변수/참조 셀</target>
<note />
</trans-unit>
<trans-unit id="FSharpPrintfFormatClassificationType">
<source>F# Printf Format</source>
<target state="translated">F# Printf 형식</target>
<note />
</trans-unit>
<trans-unit id="FSharpPropertiesClassificationType">
<source>F# Properties</source>
<target state="translated">F# 속성</target>
<note />
</trans-unit>
<trans-unit id="GenericParametersHeader">
<source>Generic parameters:</source>
<target state="translated">제네릭 매개 변수:</target>
<note />
</trans-unit>
<trans-unit id="ImplementInterface">
<source>Implement interface</source>
<target state="translated">인터페이스 구현</target>
<note />
</trans-unit>
<trans-unit id="ImplementInterfaceWithoutTypeAnnotation">
<source>Implement interface without type annotation</source>
<target state="translated">형식 주석 없이 인터페이스 구현</target>
<note />
</trans-unit>
<trans-unit id="LocatingSymbol">
<source>Locating the symbol under the caret...</source>
<target state="translated">캐럿에서 기호를 찾는 중...</target>
<note />
</trans-unit>
<trans-unit id="NameCanBeSimplified">
<source>Name can be simplified.</source>
<target state="translated">이름을 간단하게 줄일 수 있습니다.</target>
<note />
</trans-unit>
<trans-unit id="NavigateToFailed">
<source>Navigate to symbol failed: {0}</source>
<target state="translated">기호로 이동하지 못함: {0}</target>
<note />
</trans-unit>
<trans-unit id="NavigatingTo">
<source>Navigating to symbol...</source>
<target state="translated">기호로 이동하는 중...</target>
<note />
</trans-unit>
<trans-unit id="PrefixValueNameWithUnderscore">
<source>Prefix '{0}' with underscore</source>
<target state="translated">'{0}' 앞에 밑줄 붙이기</target>
<note />
</trans-unit>
<trans-unit id="RemoveUnusedOpens">
<source>Remove unused open declarations</source>
<target state="translated">사용되지 않는 열려 있는 선언 제거</target>
<note />
</trans-unit>
<trans-unit id="RenameValueToDoubleUnderscore">
<source>Rename '{0}' to '__'</source>
<target state="translated">'{0}'에서 '__'로 이름 바꾸기</target>
<note />
</trans-unit>
<trans-unit id="RenameValueToUnderscore">
<source>Rename '{0}' to '_'</source>
<target state="translated">'{0}'에서 '_'로 이름 바꾸기</target>
<note />
</trans-unit>
<trans-unit id="SimplifyName">
<source>Simplify name</source>
<target state="translated">이름 단순화</target>
<note />
</trans-unit>
<trans-unit id="TheValueIsUnused">
<source>The value is unused</source>
<target state="translated">값이 사용되지 않음</target>
<note />
</trans-unit>
<trans-unit id="UnusedOpens">
<source>Open declaration can be removed.</source>
<target state="translated">열려 있는 선언은 제거할 수 있습니다.</target>
<note />
</trans-unit>
</body>
</file>
</xliff> | -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ja" original="../CSharpFeaturesResources.resx">
<body>
<trans-unit id="Add_await">
<source>Add 'await'</source>
<target state="translated">'await' の追加</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_await_and_ConfigureAwaitFalse">
<source>Add 'await' and 'ConfigureAwait(false)'</source>
<target state="translated">'await' と 'ConfigureAwait(false)' の追加</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_missing_usings">
<source>Add missing usings</source>
<target state="translated">不足している using を追加する</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_remove_braces_for_single_line_control_statements">
<source>Add/remove braces for single-line control statements</source>
<target state="translated">単一行のコントロール ステートメントに対する波かっこの追加/削除を行います</target>
<note />
</trans-unit>
<trans-unit id="Allow_unsafe_code_in_this_project">
<source>Allow unsafe code in this project</source>
<target state="translated">このプロジェクトでアンセーフ コードを許可する</target>
<note />
</trans-unit>
<trans-unit id="Apply_expression_block_body_preferences">
<source>Apply expression/block body preferences</source>
<target state="translated">式/ブロック本体の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_implicit_explicit_type_preferences">
<source>Apply implicit/explicit type preferences</source>
<target state="translated">暗黙的/明示的な型の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_inline_out_variable_preferences">
<source>Apply inline 'out' variables preferences</source>
<target state="translated">インラインの 'out' 変数の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_language_framework_type_preferences">
<source>Apply language/framework type preferences</source>
<target state="translated">言語/フレームワークの型の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_this_qualification_preferences">
<source>Apply 'this.' qualification preferences</source>
<target state="translated">'this.' 修飾の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_using_directive_placement_preferences">
<source>Apply preferred 'using' placement preferences</source>
<target state="translated">優先する 'using' 配置設定を適用する</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Assign_out_parameters">
<source>Assign 'out' parameters</source>
<target state="translated">'out' パラメーターの割り当て</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Assign_out_parameters_at_start">
<source>Assign 'out' parameters (at start)</source>
<target state="translated">'out' パラメーターの割り当て (開始時)</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Assign_to_0">
<source>Assign to '{0}'</source>
<target state="translated">"{0}" に割り当て</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_pattern_variable_declaration">
<source>Autoselect disabled due to potential pattern variable declaration.</source>
<target state="translated">パターン変数宣言の可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Change_to_as_expression">
<source>Change to 'as' expression</source>
<target state="translated">'as' 式に変更</target>
<note />
</trans-unit>
<trans-unit id="Change_to_cast">
<source>Change to cast</source>
<target state="translated">キャストに変更</target>
<note />
</trans-unit>
<trans-unit id="Compare_to_0">
<source>Compare to '{0}'</source>
<target state="translated">"{0}" と比較</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_method">
<source>Convert to method</source>
<target state="translated">メソッドに変換</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_regular_string">
<source>Convert to regular string</source>
<target state="translated">正規文字列に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_switch_expression">
<source>Convert to 'switch' expression</source>
<target state="translated">'switch' 式に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_switch_statement">
<source>Convert to 'switch' statement</source>
<target state="translated">'switch' ステートメントに変換</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_verbatim_string">
<source>Convert to verbatim string</source>
<target state="translated">逐語的文字列に変換する</target>
<note />
</trans-unit>
<trans-unit id="Declare_as_nullable">
<source>Declare as nullable</source>
<target state="translated">Null 許容型として宣言する</target>
<note />
</trans-unit>
<trans-unit id="Fix_return_type">
<source>Fix return type</source>
<target state="translated">戻り値の型の修正</target>
<note />
</trans-unit>
<trans-unit id="Inline_temporary_variable">
<source>Inline temporary variable</source>
<target state="translated">インラインの一時変数</target>
<note />
</trans-unit>
<trans-unit id="Conflict_s_detected">
<source>Conflict(s) detected.</source>
<target state="translated">競合が検出されました。</target>
<note />
</trans-unit>
<trans-unit id="Make_container_async">
<source>Make container 'async'</source>
<target state="new">Make container 'async'</target>
<note>{Locked="async"} "async" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Make_private_field_readonly_when_possible">
<source>Make private fields readonly when possible</source>
<target state="translated">可能な場合、private フィールドを読み取り専用にする</target>
<note />
</trans-unit>
<trans-unit id="Make_ref_struct">
<source>Make 'ref struct'</source>
<target state="translated">'ref struct' を作成します</target>
<note>{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.</note>
</trans-unit>
<trans-unit id="Remove_in_keyword">
<source>Remove 'in' keyword</source>
<target state="translated">'in' キーワードを削除します</target>
<note>{Locked="in"} "in" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Remove_new_modifier">
<source>Remove 'new' modifier</source>
<target state="translated">'new' 修飾子の削除</target>
<note />
</trans-unit>
<trans-unit id="Reverse_for_statement">
<source>Reverse 'for' statement</source>
<target state="translated">'for' ステートメントの反転</target>
<note>{Locked="for"} "for" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Simplify_lambda_expression">
<source>Simplify lambda expression</source>
<target state="translated">ラムダ式の簡略化</target>
<note />
</trans-unit>
<trans-unit id="Simplify_all_occurrences">
<source>Simplify all occurrences</source>
<target state="translated">すべての出現箇所を簡素化します</target>
<note />
</trans-unit>
<trans-unit id="Sort_accessibility_modifiers">
<source>Sort accessibility modifiers</source>
<target state="translated">アクセシビリティ修飾子を並べ替える</target>
<note />
</trans-unit>
<trans-unit id="Unseal_class_0">
<source>Unseal class '{0}'</source>
<target state="translated">クラス '{0}' のシールを解除</target>
<note />
</trans-unit>
<trans-unit id="Warning_Inlining_temporary_into_conditional_method_call">
<source>Warning: Inlining temporary into conditional method call.</source>
<target state="translated">警告: 一時メソッド呼び出しを条件付きメソッド呼び出しにインライン展開しています。</target>
<note />
</trans-unit>
<trans-unit id="Warning_Inlining_temporary_variable_may_change_code_meaning">
<source>Warning: Inlining temporary variable may change code meaning.</source>
<target state="translated">警告: 一時変数をインライン化すると、コードの意味が変わる可能性があります。</target>
<note />
</trans-unit>
<trans-unit id="asynchronous_foreach_statement">
<source>asynchronous foreach statement</source>
<target state="translated">非同期の foreach ステートメント</target>
<note>{Locked="foreach"} "foreach" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="asynchronous_using_declaration">
<source>asynchronous using declaration</source>
<target state="translated">非同期の using 宣言</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="extern_alias">
<source>extern alias</source>
<target state="translated">extern エイリアス</target>
<note />
</trans-unit>
<trans-unit id="lambda_expression">
<source><lambda expression></source>
<target state="translated"><ラムダ式></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_lambda_declaration">
<source>Autoselect disabled due to potential lambda declaration.</source>
<target state="translated">ラムダが宣言された可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="local_variable_declaration">
<source>local variable declaration</source>
<target state="translated">ローカル変数宣言</target>
<note />
</trans-unit>
<trans-unit id="member_name">
<source><member name> = </source>
<target state="translated"><メンバー名> =</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_explicitly_named_anonymous_type_member_creation">
<source>Autoselect disabled due to possible explicitly named anonymous type member creation.</source>
<target state="translated">明示的に指定された匿名型メンバーの作成である可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="element_name">
<source><element name> : </source>
<target state="translated"><要素名>:</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_tuple_type_element_creation">
<source>Autoselect disabled due to possible tuple type element creation.</source>
<target state="translated">タプル型の要素が作成された可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="pattern_variable">
<source><pattern variable></source>
<target state="translated"><pattern variable></target>
<note />
</trans-unit>
<trans-unit id="range_variable">
<source><range variable></source>
<target state="translated"><範囲変数></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_range_variable_declaration">
<source>Autoselect disabled due to potential range variable declaration.</source>
<target state="translated">範囲変数宣言の可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Simplify_name_0">
<source>Simplify name '{0}'</source>
<target state="translated">名前 '{0}' の単純化</target>
<note />
</trans-unit>
<trans-unit id="Simplify_member_access_0">
<source>Simplify member access '{0}'</source>
<target state="translated">メンバーのアクセス '{0}' を単純化します</target>
<note />
</trans-unit>
<trans-unit id="Remove_this_qualification">
<source>Remove 'this' qualification</source>
<target state="translated">this' 修飾子を削除します</target>
<note />
</trans-unit>
<trans-unit id="Name_can_be_simplified">
<source>Name can be simplified</source>
<target state="translated">名前を簡略化できます</target>
<note />
</trans-unit>
<trans-unit id="Can_t_determine_valid_range_of_statements_to_extract">
<source>Can't determine valid range of statements to extract</source>
<target state="translated">抽出するステートメントの有効な範囲を決定できません</target>
<note />
</trans-unit>
<trans-unit id="Not_all_code_paths_return">
<source>Not all code paths return</source>
<target state="translated">返されないコード パスがあります</target>
<note />
</trans-unit>
<trans-unit id="Selection_does_not_contain_a_valid_node">
<source>Selection does not contain a valid node</source>
<target state="translated">選択には有効なノードは含まれません</target>
<note />
</trans-unit>
<trans-unit id="Invalid_selection">
<source>Invalid selection.</source>
<target state="translated">選択が無効です。</target>
<note />
</trans-unit>
<trans-unit id="Selection_does_not_contain_a_valid_token">
<source>Selection does not contain a valid token.</source>
<target state="translated">選択には有効なトークンは含まれません。</target>
<note />
</trans-unit>
<trans-unit id="No_valid_selection_to_perform_extraction">
<source>No valid selection to perform extraction.</source>
<target state="translated">抽出を行うための有効な選択がありません。</target>
<note />
</trans-unit>
<trans-unit id="No_common_root_node_for_extraction">
<source>No common root node for extraction.</source>
<target state="translated">抽出するための一般的なルート ノードがありません。</target>
<note />
</trans-unit>
<trans-unit id="Contains_invalid_selection">
<source>Contains invalid selection.</source>
<target state="translated">無効な選択が含まれています。</target>
<note />
</trans-unit>
<trans-unit id="The_selection_contains_syntactic_errors">
<source>The selection contains syntactic errors</source>
<target state="translated">選択に構文エラーが含まれています</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_cross_over_preprocessor_directives">
<source>Selection can not cross over preprocessor directives.</source>
<target state="translated">選択範囲はプリプロセッサ ディレクティブ上を通過できません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_a_yield_statement">
<source>Selection can not contain a yield statement.</source>
<target state="translated">選択範囲に yield ステートメントを含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_throw_statement">
<source>Selection can not contain throw statement.</source>
<target state="translated">選択範囲に throw ステートメントを含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_be_part_of_constant_initializer_expression">
<source>Selection can not be part of constant initializer expression.</source>
<target state="translated">選択範囲を定数の初期化子式の一部にすることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_a_pattern_expression">
<source>Selection can not contain a pattern expression.</source>
<target state="translated">選択に、パターン式を含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="The_selected_code_is_inside_an_unsafe_context">
<source>The selected code is inside an unsafe context.</source>
<target state="translated">選択されたコードは unsafe コンテキストの内側にあります。</target>
<note />
</trans-unit>
<trans-unit id="No_valid_statement_range_to_extract">
<source>No valid statement range to extract</source>
<target state="translated">抽出する有効なステートメントの範囲がありません</target>
<note />
</trans-unit>
<trans-unit id="deprecated">
<source>deprecated</source>
<target state="translated">非推奨</target>
<note />
</trans-unit>
<trans-unit id="extension">
<source>extension</source>
<target state="translated">拡張子</target>
<note />
</trans-unit>
<trans-unit id="awaitable">
<source>awaitable</source>
<target state="translated">待機可能</target>
<note />
</trans-unit>
<trans-unit id="awaitable_extension">
<source>awaitable, extension</source>
<target state="translated">待機可能、拡張子</target>
<note />
</trans-unit>
<trans-unit id="Organize_Usings">
<source>Organize Usings</source>
<target state="translated">using の整理</target>
<note />
</trans-unit>
<trans-unit id="Insert_await">
<source>Insert 'await'.</source>
<target state="translated">await' を挿入します。</target>
<note />
</trans-unit>
<trans-unit id="Make_0_return_Task_instead_of_void">
<source>Make {0} return Task instead of void.</source>
<target state="translated">{0} が void ではなくタスクを返すようにします。</target>
<note />
</trans-unit>
<trans-unit id="Change_return_type_from_0_to_1">
<source>Change return type from {0} to {1}</source>
<target state="translated">戻り値の型を {0} から {1} に変更する</target>
<note />
</trans-unit>
<trans-unit id="Replace_return_with_yield_return">
<source>Replace return with yield return</source>
<target state="translated">戻り値を 'yield' の戻り値に置き換える</target>
<note />
</trans-unit>
<trans-unit id="Generate_explicit_conversion_operator_in_0">
<source>Generate explicit conversion operator in '{0}'</source>
<target state="translated">明示的な変換演算子を '{0}' に生成します</target>
<note />
</trans-unit>
<trans-unit id="Generate_implicit_conversion_operator_in_0">
<source>Generate implicit conversion operator in '{0}'</source>
<target state="translated">暗黙的な変換演算子を '{0}' に生成します</target>
<note />
</trans-unit>
<trans-unit id="record_">
<source>record</source>
<target state="translated">レコード</target>
<note />
</trans-unit>
<trans-unit id="record_struct">
<source>record struct</source>
<target state="new">record struct</target>
<note />
</trans-unit>
<trans-unit id="switch_statement">
<source>switch statement</source>
<target state="translated">switch ステートメント</target>
<note>{Locked="switch"} "switch" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="switch_statement_case_clause">
<source>switch statement case clause</source>
<target state="translated">switch ステートメントの case 句</target>
<note>{Locked="switch"}{Locked="case"} "switch" and "case" are a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="try_block">
<source>try block</source>
<target state="translated">try ブロック</target>
<note>{Locked="try"} "try" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="catch_clause">
<source>catch clause</source>
<target state="translated">catch 句</target>
<note>{Locked="catch"} "catch" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="filter_clause">
<source>filter clause</source>
<target state="translated">フィルター句</target>
<note />
</trans-unit>
<trans-unit id="finally_clause">
<source>finally clause</source>
<target state="translated">finally 句</target>
<note>{Locked="finally"} "finally" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="fixed_statement">
<source>fixed statement</source>
<target state="translated">fixed ステートメント</target>
<note>{Locked="fixed"} "fixed" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_declaration">
<source>using declaration</source>
<target state="translated">using 宣言</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_statement">
<source>using statement</source>
<target state="translated">using ステートメント</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="lock_statement">
<source>lock statement</source>
<target state="translated">lock ステートメント</target>
<note>{Locked="lock"} "lock" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="foreach_statement">
<source>foreach statement</source>
<target state="translated">foreach ステートメント</target>
<note>{Locked="foreach"} "foreach" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="checked_statement">
<source>checked statement</source>
<target state="translated">checked ステートメント</target>
<note>{Locked="checked"} "checked" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="unchecked_statement">
<source>unchecked statement</source>
<target state="translated">unchecked ステートメント</target>
<note>{Locked="unchecked"} "unchecked" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="await_expression">
<source>await expression</source>
<target state="translated">await 式</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="lambda">
<source>lambda</source>
<target state="translated">ラムダ</target>
<note />
</trans-unit>
<trans-unit id="anonymous_method">
<source>anonymous method</source>
<target state="translated">匿名メソッド</target>
<note />
</trans-unit>
<trans-unit id="from_clause">
<source>from clause</source>
<target state="translated">from 句</target>
<note />
</trans-unit>
<trans-unit id="join_clause">
<source>join clause</source>
<target state="translated">join 句</target>
<note>{Locked="join"} "join" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="let_clause">
<source>let clause</source>
<target state="translated">let 句</target>
<note>{Locked="let"} "let" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="where_clause">
<source>where clause</source>
<target state="translated">where 句</target>
<note>{Locked="where"} "where" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="orderby_clause">
<source>orderby clause</source>
<target state="translated">orderby 句</target>
<note>{Locked="orderby"} "orderby" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="select_clause">
<source>select clause</source>
<target state="translated">select 句</target>
<note>{Locked="select"} "select" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="groupby_clause">
<source>groupby clause</source>
<target state="translated">groupby 句</target>
<note>{Locked="groupby"} "groupby" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="query_body">
<source>query body</source>
<target state="translated">クエリ本体</target>
<note />
</trans-unit>
<trans-unit id="into_clause">
<source>into clause</source>
<target state="translated">into 句</target>
<note>{Locked="into"} "into" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="is_pattern">
<source>is pattern</source>
<target state="translated">is パターン</target>
<note>{Locked="is"} "is" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="deconstruction">
<source>deconstruction</source>
<target state="translated">分解</target>
<note />
</trans-unit>
<trans-unit id="tuple">
<source>tuple</source>
<target state="translated">タプル</target>
<note />
</trans-unit>
<trans-unit id="local_function">
<source>local function</source>
<target state="translated">ローカル関数</target>
<note />
</trans-unit>
<trans-unit id="out_var">
<source>out variable</source>
<target state="translated">out 変数</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="ref_local_or_expression">
<source>ref local or expression</source>
<target state="translated">ref ローカルまたは式</target>
<note>{Locked="ref"} "ref" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="global_statement">
<source>global statement</source>
<target state="translated">global ステートメント</target>
<note>{Locked="global"} "global" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_directive">
<source>using directive</source>
<target state="translated">using ディレクティブ</target>
<note />
</trans-unit>
<trans-unit id="event_field">
<source>event field</source>
<target state="translated">イベント フィールド</target>
<note />
</trans-unit>
<trans-unit id="conversion_operator">
<source>conversion operator</source>
<target state="translated">変換演算子</target>
<note />
</trans-unit>
<trans-unit id="destructor">
<source>destructor</source>
<target state="translated">デストラクター</target>
<note />
</trans-unit>
<trans-unit id="indexer">
<source>indexer</source>
<target state="translated">インデクサー</target>
<note />
</trans-unit>
<trans-unit id="property_getter">
<source>property getter</source>
<target state="translated">プロパティ ゲッター</target>
<note />
</trans-unit>
<trans-unit id="indexer_getter">
<source>indexer getter</source>
<target state="translated">インデクサー ゲッター</target>
<note />
</trans-unit>
<trans-unit id="property_setter">
<source>property setter</source>
<target state="translated">プロパティ set アクセス操作子</target>
<note />
</trans-unit>
<trans-unit id="indexer_setter">
<source>indexer setter</source>
<target state="translated">インデクサー set アクセス操作子</target>
<note />
</trans-unit>
<trans-unit id="attribute_target">
<source>attribute target</source>
<target state="translated">属性ターゲット</target>
<note />
</trans-unit>
<trans-unit id="_0_does_not_contain_a_constructor_that_takes_that_many_arguments">
<source>'{0}' does not contain a constructor that takes that many arguments.</source>
<target state="translated">'{0}' には、多数の引数を指定できるコンストラクターがありません。</target>
<note />
</trans-unit>
<trans-unit id="The_name_0_does_not_exist_in_the_current_context">
<source>The name '{0}' does not exist in the current context.</source>
<target state="translated">名前 '{0}' は、現在のコンテキストに存在しません。</target>
<note />
</trans-unit>
<trans-unit id="Hide_base_member">
<source>Hide base member</source>
<target state="translated">基本メンバーを非表示にします</target>
<note />
</trans-unit>
<trans-unit id="Properties">
<source>Properties</source>
<target state="translated">プロパティ</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_namespace_declaration">
<source>Autoselect disabled due to namespace declaration.</source>
<target state="translated">名前空間宣言により、Autoselect は無効です。</target>
<note />
</trans-unit>
<trans-unit id="namespace_name">
<source><namespace name></source>
<target state="translated"><名前空間名></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_type_declaration">
<source>Autoselect disabled due to type declaration.</source>
<target state="translated">型宣言が原因で、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_deconstruction_declaration">
<source>Autoselect disabled due to possible deconstruction declaration.</source>
<target state="translated">分解宣言の可能性により、自動選択が無効になりました。</target>
<note />
</trans-unit>
<trans-unit id="Upgrade_this_project_to_csharp_language_version_0">
<source>Upgrade this project to C# language version '{0}'</source>
<target state="translated">このプロジェクトを C# 言語バージョン '{0}' にアップグレードする</target>
<note />
</trans-unit>
<trans-unit id="Upgrade_all_csharp_projects_to_language_version_0">
<source>Upgrade all C# projects to language version '{0}'</source>
<target state="translated">すべての C# プロジェクトを言語バージョン '{0}' にアップグレードする</target>
<note />
</trans-unit>
<trans-unit id="class_name">
<source><class name></source>
<target state="translated"><クラス名></target>
<note />
</trans-unit>
<trans-unit id="interface_name">
<source><interface name></source>
<target state="translated"><インターフェイス名></target>
<note />
</trans-unit>
<trans-unit id="designation_name">
<source><designation name></source>
<target state="translated"><指定名></target>
<note />
</trans-unit>
<trans-unit id="struct_name">
<source><struct name></source>
<target state="translated"><構造体名></target>
<note />
</trans-unit>
<trans-unit id="Make_method_async">
<source>Make method async</source>
<target state="translated">メソッドを非同期にします</target>
<note />
</trans-unit>
<trans-unit id="Make_method_async_remain_void">
<source>Make method async (stay void)</source>
<target state="translated">メソッドを非同期にする (void を維持)</target>
<note />
</trans-unit>
<trans-unit id="Name">
<source><Name></source>
<target state="translated"><名前></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_member_declaration">
<source>Autoselect disabled due to member declaration</source>
<target state="translated">メンバー宣言が原因で自動選択が無効になりました</target>
<note />
</trans-unit>
<trans-unit id="Suggested_name">
<source>(Suggested name)</source>
<target state="translated">(推奨される名前)</target>
<note />
</trans-unit>
<trans-unit id="Remove_unused_function">
<source>Remove unused function</source>
<target state="translated">使用されていない関数を削除します</target>
<note />
</trans-unit>
<trans-unit id="Add_parentheses_around_conditional_expression_in_interpolated_string">
<source>Add parentheses</source>
<target state="translated">括弧を追加します</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_foreach">
<source>Convert to 'foreach'</source>
<target state="translated">'foreach' に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_for">
<source>Convert to 'for'</source>
<target state="translated">'for' に変換する</target>
<note />
</trans-unit>
<trans-unit id="Invert_if">
<source>Invert if</source>
<target state="translated">if を反転する</target>
<note />
</trans-unit>
<trans-unit id="Add_Obsolete">
<source>Add [Obsolete]</source>
<target state="translated">追加 [廃止]</target>
<note />
</trans-unit>
<trans-unit id="Use_0">
<source>Use '{0}'</source>
<target state="translated">'{0}' を使用します</target>
<note />
</trans-unit>
<trans-unit id="Introduce_using_statement">
<source>Introduce 'using' statement</source>
<target state="translated">'using' ステートメントを導入します</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="yield_break_statement">
<source>yield break statement</source>
<target state="translated">yield break ステートメント</target>
<note>{Locked="yield break"} "yield break" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="yield_return_statement">
<source>yield return statement</source>
<target state="translated">yield return ステートメント</target>
<note>{Locked="yield return"} "yield return" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff> | <?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ja" original="../CSharpFeaturesResources.resx">
<body>
<trans-unit id="Add_await">
<source>Add 'await'</source>
<target state="translated">'await' の追加</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_await_and_ConfigureAwaitFalse">
<source>Add 'await' and 'ConfigureAwait(false)'</source>
<target state="translated">'await' と 'ConfigureAwait(false)' の追加</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_missing_usings">
<source>Add missing usings</source>
<target state="translated">不足している using を追加する</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Add_remove_braces_for_single_line_control_statements">
<source>Add/remove braces for single-line control statements</source>
<target state="translated">単一行のコントロール ステートメントに対する波かっこの追加/削除を行います</target>
<note />
</trans-unit>
<trans-unit id="Allow_unsafe_code_in_this_project">
<source>Allow unsafe code in this project</source>
<target state="translated">このプロジェクトでアンセーフ コードを許可する</target>
<note />
</trans-unit>
<trans-unit id="Apply_expression_block_body_preferences">
<source>Apply expression/block body preferences</source>
<target state="translated">式/ブロック本体の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_implicit_explicit_type_preferences">
<source>Apply implicit/explicit type preferences</source>
<target state="translated">暗黙的/明示的な型の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_inline_out_variable_preferences">
<source>Apply inline 'out' variables preferences</source>
<target state="translated">インラインの 'out' 変数の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_language_framework_type_preferences">
<source>Apply language/framework type preferences</source>
<target state="translated">言語/フレームワークの型の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_this_qualification_preferences">
<source>Apply 'this.' qualification preferences</source>
<target state="translated">'this.' 修飾の基本設定を適用します</target>
<note />
</trans-unit>
<trans-unit id="Apply_using_directive_placement_preferences">
<source>Apply preferred 'using' placement preferences</source>
<target state="translated">優先する 'using' 配置設定を適用する</target>
<note>'using' is a C# keyword and should not be localized</note>
</trans-unit>
<trans-unit id="Assign_out_parameters">
<source>Assign 'out' parameters</source>
<target state="translated">'out' パラメーターの割り当て</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Assign_out_parameters_at_start">
<source>Assign 'out' parameters (at start)</source>
<target state="translated">'out' パラメーターの割り当て (開始時)</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Assign_to_0">
<source>Assign to '{0}'</source>
<target state="translated">"{0}" に割り当て</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_pattern_variable_declaration">
<source>Autoselect disabled due to potential pattern variable declaration.</source>
<target state="translated">パターン変数宣言の可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Change_to_as_expression">
<source>Change to 'as' expression</source>
<target state="translated">'as' 式に変更</target>
<note />
</trans-unit>
<trans-unit id="Change_to_cast">
<source>Change to cast</source>
<target state="translated">キャストに変更</target>
<note />
</trans-unit>
<trans-unit id="Compare_to_0">
<source>Compare to '{0}'</source>
<target state="translated">"{0}" と比較</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_method">
<source>Convert to method</source>
<target state="translated">メソッドに変換</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_regular_string">
<source>Convert to regular string</source>
<target state="translated">正規文字列に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_switch_expression">
<source>Convert to 'switch' expression</source>
<target state="translated">'switch' 式に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_switch_statement">
<source>Convert to 'switch' statement</source>
<target state="translated">'switch' ステートメントに変換</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_verbatim_string">
<source>Convert to verbatim string</source>
<target state="translated">逐語的文字列に変換する</target>
<note />
</trans-unit>
<trans-unit id="Declare_as_nullable">
<source>Declare as nullable</source>
<target state="translated">Null 許容型として宣言する</target>
<note />
</trans-unit>
<trans-unit id="Fix_return_type">
<source>Fix return type</source>
<target state="translated">戻り値の型の修正</target>
<note />
</trans-unit>
<trans-unit id="Inline_temporary_variable">
<source>Inline temporary variable</source>
<target state="translated">インラインの一時変数</target>
<note />
</trans-unit>
<trans-unit id="Conflict_s_detected">
<source>Conflict(s) detected.</source>
<target state="translated">競合が検出されました。</target>
<note />
</trans-unit>
<trans-unit id="Make_container_async">
<source>Make container 'async'</source>
<target state="new">Make container 'async'</target>
<note>{Locked="async"} "async" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Make_private_field_readonly_when_possible">
<source>Make private fields readonly when possible</source>
<target state="translated">可能な場合、private フィールドを読み取り専用にする</target>
<note />
</trans-unit>
<trans-unit id="Make_ref_struct">
<source>Make 'ref struct'</source>
<target state="translated">'ref struct' を作成します</target>
<note>{Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized.</note>
</trans-unit>
<trans-unit id="Remove_in_keyword">
<source>Remove 'in' keyword</source>
<target state="translated">'in' キーワードを削除します</target>
<note>{Locked="in"} "in" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Remove_new_modifier">
<source>Remove 'new' modifier</source>
<target state="translated">'new' 修飾子の削除</target>
<note />
</trans-unit>
<trans-unit id="Reverse_for_statement">
<source>Reverse 'for' statement</source>
<target state="translated">'for' ステートメントの反転</target>
<note>{Locked="for"} "for" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="Simplify_lambda_expression">
<source>Simplify lambda expression</source>
<target state="translated">ラムダ式の簡略化</target>
<note />
</trans-unit>
<trans-unit id="Simplify_all_occurrences">
<source>Simplify all occurrences</source>
<target state="translated">すべての出現箇所を簡素化します</target>
<note />
</trans-unit>
<trans-unit id="Sort_accessibility_modifiers">
<source>Sort accessibility modifiers</source>
<target state="translated">アクセシビリティ修飾子を並べ替える</target>
<note />
</trans-unit>
<trans-unit id="Unseal_class_0">
<source>Unseal class '{0}'</source>
<target state="translated">クラス '{0}' のシールを解除</target>
<note />
</trans-unit>
<trans-unit id="Warning_Inlining_temporary_into_conditional_method_call">
<source>Warning: Inlining temporary into conditional method call.</source>
<target state="translated">警告: 一時メソッド呼び出しを条件付きメソッド呼び出しにインライン展開しています。</target>
<note />
</trans-unit>
<trans-unit id="Warning_Inlining_temporary_variable_may_change_code_meaning">
<source>Warning: Inlining temporary variable may change code meaning.</source>
<target state="translated">警告: 一時変数をインライン化すると、コードの意味が変わる可能性があります。</target>
<note />
</trans-unit>
<trans-unit id="asynchronous_foreach_statement">
<source>asynchronous foreach statement</source>
<target state="translated">非同期の foreach ステートメント</target>
<note>{Locked="foreach"} "foreach" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="asynchronous_using_declaration">
<source>asynchronous using declaration</source>
<target state="translated">非同期の using 宣言</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="extern_alias">
<source>extern alias</source>
<target state="translated">extern エイリアス</target>
<note />
</trans-unit>
<trans-unit id="lambda_expression">
<source><lambda expression></source>
<target state="translated"><ラムダ式></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_lambda_declaration">
<source>Autoselect disabled due to potential lambda declaration.</source>
<target state="translated">ラムダが宣言された可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="local_variable_declaration">
<source>local variable declaration</source>
<target state="translated">ローカル変数宣言</target>
<note />
</trans-unit>
<trans-unit id="member_name">
<source><member name> = </source>
<target state="translated"><メンバー名> =</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_explicitly_named_anonymous_type_member_creation">
<source>Autoselect disabled due to possible explicitly named anonymous type member creation.</source>
<target state="translated">明示的に指定された匿名型メンバーの作成である可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="element_name">
<source><element name> : </source>
<target state="translated"><要素名>:</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_tuple_type_element_creation">
<source>Autoselect disabled due to possible tuple type element creation.</source>
<target state="translated">タプル型の要素が作成された可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="pattern_variable">
<source><pattern variable></source>
<target state="translated"><pattern variable></target>
<note />
</trans-unit>
<trans-unit id="range_variable">
<source><range variable></source>
<target state="translated"><範囲変数></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_potential_range_variable_declaration">
<source>Autoselect disabled due to potential range variable declaration.</source>
<target state="translated">範囲変数宣言の可能性があるため、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Simplify_name_0">
<source>Simplify name '{0}'</source>
<target state="translated">名前 '{0}' の単純化</target>
<note />
</trans-unit>
<trans-unit id="Simplify_member_access_0">
<source>Simplify member access '{0}'</source>
<target state="translated">メンバーのアクセス '{0}' を単純化します</target>
<note />
</trans-unit>
<trans-unit id="Remove_this_qualification">
<source>Remove 'this' qualification</source>
<target state="translated">this' 修飾子を削除します</target>
<note />
</trans-unit>
<trans-unit id="Name_can_be_simplified">
<source>Name can be simplified</source>
<target state="translated">名前を簡略化できます</target>
<note />
</trans-unit>
<trans-unit id="Can_t_determine_valid_range_of_statements_to_extract">
<source>Can't determine valid range of statements to extract</source>
<target state="translated">抽出するステートメントの有効な範囲を決定できません</target>
<note />
</trans-unit>
<trans-unit id="Not_all_code_paths_return">
<source>Not all code paths return</source>
<target state="translated">返されないコード パスがあります</target>
<note />
</trans-unit>
<trans-unit id="Selection_does_not_contain_a_valid_node">
<source>Selection does not contain a valid node</source>
<target state="translated">選択には有効なノードは含まれません</target>
<note />
</trans-unit>
<trans-unit id="Invalid_selection">
<source>Invalid selection.</source>
<target state="translated">選択が無効です。</target>
<note />
</trans-unit>
<trans-unit id="Selection_does_not_contain_a_valid_token">
<source>Selection does not contain a valid token.</source>
<target state="translated">選択には有効なトークンは含まれません。</target>
<note />
</trans-unit>
<trans-unit id="No_valid_selection_to_perform_extraction">
<source>No valid selection to perform extraction.</source>
<target state="translated">抽出を行うための有効な選択がありません。</target>
<note />
</trans-unit>
<trans-unit id="No_common_root_node_for_extraction">
<source>No common root node for extraction.</source>
<target state="translated">抽出するための一般的なルート ノードがありません。</target>
<note />
</trans-unit>
<trans-unit id="Contains_invalid_selection">
<source>Contains invalid selection.</source>
<target state="translated">無効な選択が含まれています。</target>
<note />
</trans-unit>
<trans-unit id="The_selection_contains_syntactic_errors">
<source>The selection contains syntactic errors</source>
<target state="translated">選択に構文エラーが含まれています</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_cross_over_preprocessor_directives">
<source>Selection can not cross over preprocessor directives.</source>
<target state="translated">選択範囲はプリプロセッサ ディレクティブ上を通過できません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_a_yield_statement">
<source>Selection can not contain a yield statement.</source>
<target state="translated">選択範囲に yield ステートメントを含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_throw_statement">
<source>Selection can not contain throw statement.</source>
<target state="translated">選択範囲に throw ステートメントを含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_be_part_of_constant_initializer_expression">
<source>Selection can not be part of constant initializer expression.</source>
<target state="translated">選択範囲を定数の初期化子式の一部にすることはできません。</target>
<note />
</trans-unit>
<trans-unit id="Selection_can_not_contain_a_pattern_expression">
<source>Selection can not contain a pattern expression.</source>
<target state="translated">選択に、パターン式を含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="The_selected_code_is_inside_an_unsafe_context">
<source>The selected code is inside an unsafe context.</source>
<target state="translated">選択されたコードは unsafe コンテキストの内側にあります。</target>
<note />
</trans-unit>
<trans-unit id="No_valid_statement_range_to_extract">
<source>No valid statement range to extract</source>
<target state="translated">抽出する有効なステートメントの範囲がありません</target>
<note />
</trans-unit>
<trans-unit id="deprecated">
<source>deprecated</source>
<target state="translated">非推奨</target>
<note />
</trans-unit>
<trans-unit id="extension">
<source>extension</source>
<target state="translated">拡張子</target>
<note />
</trans-unit>
<trans-unit id="awaitable">
<source>awaitable</source>
<target state="translated">待機可能</target>
<note />
</trans-unit>
<trans-unit id="awaitable_extension">
<source>awaitable, extension</source>
<target state="translated">待機可能、拡張子</target>
<note />
</trans-unit>
<trans-unit id="Organize_Usings">
<source>Organize Usings</source>
<target state="translated">using の整理</target>
<note />
</trans-unit>
<trans-unit id="Insert_await">
<source>Insert 'await'.</source>
<target state="translated">await' を挿入します。</target>
<note />
</trans-unit>
<trans-unit id="Make_0_return_Task_instead_of_void">
<source>Make {0} return Task instead of void.</source>
<target state="translated">{0} が void ではなくタスクを返すようにします。</target>
<note />
</trans-unit>
<trans-unit id="Change_return_type_from_0_to_1">
<source>Change return type from {0} to {1}</source>
<target state="translated">戻り値の型を {0} から {1} に変更する</target>
<note />
</trans-unit>
<trans-unit id="Replace_return_with_yield_return">
<source>Replace return with yield return</source>
<target state="translated">戻り値を 'yield' の戻り値に置き換える</target>
<note />
</trans-unit>
<trans-unit id="Generate_explicit_conversion_operator_in_0">
<source>Generate explicit conversion operator in '{0}'</source>
<target state="translated">明示的な変換演算子を '{0}' に生成します</target>
<note />
</trans-unit>
<trans-unit id="Generate_implicit_conversion_operator_in_0">
<source>Generate implicit conversion operator in '{0}'</source>
<target state="translated">暗黙的な変換演算子を '{0}' に生成します</target>
<note />
</trans-unit>
<trans-unit id="record_">
<source>record</source>
<target state="translated">レコード</target>
<note />
</trans-unit>
<trans-unit id="record_struct">
<source>record struct</source>
<target state="new">record struct</target>
<note />
</trans-unit>
<trans-unit id="switch_statement">
<source>switch statement</source>
<target state="translated">switch ステートメント</target>
<note>{Locked="switch"} "switch" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="switch_statement_case_clause">
<source>switch statement case clause</source>
<target state="translated">switch ステートメントの case 句</target>
<note>{Locked="switch"}{Locked="case"} "switch" and "case" are a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="try_block">
<source>try block</source>
<target state="translated">try ブロック</target>
<note>{Locked="try"} "try" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="catch_clause">
<source>catch clause</source>
<target state="translated">catch 句</target>
<note>{Locked="catch"} "catch" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="filter_clause">
<source>filter clause</source>
<target state="translated">フィルター句</target>
<note />
</trans-unit>
<trans-unit id="finally_clause">
<source>finally clause</source>
<target state="translated">finally 句</target>
<note>{Locked="finally"} "finally" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="fixed_statement">
<source>fixed statement</source>
<target state="translated">fixed ステートメント</target>
<note>{Locked="fixed"} "fixed" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_declaration">
<source>using declaration</source>
<target state="translated">using 宣言</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_statement">
<source>using statement</source>
<target state="translated">using ステートメント</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="lock_statement">
<source>lock statement</source>
<target state="translated">lock ステートメント</target>
<note>{Locked="lock"} "lock" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="foreach_statement">
<source>foreach statement</source>
<target state="translated">foreach ステートメント</target>
<note>{Locked="foreach"} "foreach" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="checked_statement">
<source>checked statement</source>
<target state="translated">checked ステートメント</target>
<note>{Locked="checked"} "checked" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="unchecked_statement">
<source>unchecked statement</source>
<target state="translated">unchecked ステートメント</target>
<note>{Locked="unchecked"} "unchecked" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="await_expression">
<source>await expression</source>
<target state="translated">await 式</target>
<note>{Locked="await"} "await" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="lambda">
<source>lambda</source>
<target state="translated">ラムダ</target>
<note />
</trans-unit>
<trans-unit id="anonymous_method">
<source>anonymous method</source>
<target state="translated">匿名メソッド</target>
<note />
</trans-unit>
<trans-unit id="from_clause">
<source>from clause</source>
<target state="translated">from 句</target>
<note />
</trans-unit>
<trans-unit id="join_clause">
<source>join clause</source>
<target state="translated">join 句</target>
<note>{Locked="join"} "join" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="let_clause">
<source>let clause</source>
<target state="translated">let 句</target>
<note>{Locked="let"} "let" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="where_clause">
<source>where clause</source>
<target state="translated">where 句</target>
<note>{Locked="where"} "where" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="orderby_clause">
<source>orderby clause</source>
<target state="translated">orderby 句</target>
<note>{Locked="orderby"} "orderby" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="select_clause">
<source>select clause</source>
<target state="translated">select 句</target>
<note>{Locked="select"} "select" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="groupby_clause">
<source>groupby clause</source>
<target state="translated">groupby 句</target>
<note>{Locked="groupby"} "groupby" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="query_body">
<source>query body</source>
<target state="translated">クエリ本体</target>
<note />
</trans-unit>
<trans-unit id="into_clause">
<source>into clause</source>
<target state="translated">into 句</target>
<note>{Locked="into"} "into" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="is_pattern">
<source>is pattern</source>
<target state="translated">is パターン</target>
<note>{Locked="is"} "is" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="deconstruction">
<source>deconstruction</source>
<target state="translated">分解</target>
<note />
</trans-unit>
<trans-unit id="tuple">
<source>tuple</source>
<target state="translated">タプル</target>
<note />
</trans-unit>
<trans-unit id="local_function">
<source>local function</source>
<target state="translated">ローカル関数</target>
<note />
</trans-unit>
<trans-unit id="out_var">
<source>out variable</source>
<target state="translated">out 変数</target>
<note>{Locked="out"} "out" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="ref_local_or_expression">
<source>ref local or expression</source>
<target state="translated">ref ローカルまたは式</target>
<note>{Locked="ref"} "ref" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="global_statement">
<source>global statement</source>
<target state="translated">global ステートメント</target>
<note>{Locked="global"} "global" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="using_directive">
<source>using directive</source>
<target state="translated">using ディレクティブ</target>
<note />
</trans-unit>
<trans-unit id="event_field">
<source>event field</source>
<target state="translated">イベント フィールド</target>
<note />
</trans-unit>
<trans-unit id="conversion_operator">
<source>conversion operator</source>
<target state="translated">変換演算子</target>
<note />
</trans-unit>
<trans-unit id="destructor">
<source>destructor</source>
<target state="translated">デストラクター</target>
<note />
</trans-unit>
<trans-unit id="indexer">
<source>indexer</source>
<target state="translated">インデクサー</target>
<note />
</trans-unit>
<trans-unit id="property_getter">
<source>property getter</source>
<target state="translated">プロパティ ゲッター</target>
<note />
</trans-unit>
<trans-unit id="indexer_getter">
<source>indexer getter</source>
<target state="translated">インデクサー ゲッター</target>
<note />
</trans-unit>
<trans-unit id="property_setter">
<source>property setter</source>
<target state="translated">プロパティ set アクセス操作子</target>
<note />
</trans-unit>
<trans-unit id="indexer_setter">
<source>indexer setter</source>
<target state="translated">インデクサー set アクセス操作子</target>
<note />
</trans-unit>
<trans-unit id="attribute_target">
<source>attribute target</source>
<target state="translated">属性ターゲット</target>
<note />
</trans-unit>
<trans-unit id="_0_does_not_contain_a_constructor_that_takes_that_many_arguments">
<source>'{0}' does not contain a constructor that takes that many arguments.</source>
<target state="translated">'{0}' には、多数の引数を指定できるコンストラクターがありません。</target>
<note />
</trans-unit>
<trans-unit id="The_name_0_does_not_exist_in_the_current_context">
<source>The name '{0}' does not exist in the current context.</source>
<target state="translated">名前 '{0}' は、現在のコンテキストに存在しません。</target>
<note />
</trans-unit>
<trans-unit id="Hide_base_member">
<source>Hide base member</source>
<target state="translated">基本メンバーを非表示にします</target>
<note />
</trans-unit>
<trans-unit id="Properties">
<source>Properties</source>
<target state="translated">プロパティ</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_namespace_declaration">
<source>Autoselect disabled due to namespace declaration.</source>
<target state="translated">名前空間宣言により、Autoselect は無効です。</target>
<note />
</trans-unit>
<trans-unit id="namespace_name">
<source><namespace name></source>
<target state="translated"><名前空間名></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_type_declaration">
<source>Autoselect disabled due to type declaration.</source>
<target state="translated">型宣言が原因で、自動選択は無効になっています。</target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_possible_deconstruction_declaration">
<source>Autoselect disabled due to possible deconstruction declaration.</source>
<target state="translated">分解宣言の可能性により、自動選択が無効になりました。</target>
<note />
</trans-unit>
<trans-unit id="Upgrade_this_project_to_csharp_language_version_0">
<source>Upgrade this project to C# language version '{0}'</source>
<target state="translated">このプロジェクトを C# 言語バージョン '{0}' にアップグレードする</target>
<note />
</trans-unit>
<trans-unit id="Upgrade_all_csharp_projects_to_language_version_0">
<source>Upgrade all C# projects to language version '{0}'</source>
<target state="translated">すべての C# プロジェクトを言語バージョン '{0}' にアップグレードする</target>
<note />
</trans-unit>
<trans-unit id="class_name">
<source><class name></source>
<target state="translated"><クラス名></target>
<note />
</trans-unit>
<trans-unit id="interface_name">
<source><interface name></source>
<target state="translated"><インターフェイス名></target>
<note />
</trans-unit>
<trans-unit id="designation_name">
<source><designation name></source>
<target state="translated"><指定名></target>
<note />
</trans-unit>
<trans-unit id="struct_name">
<source><struct name></source>
<target state="translated"><構造体名></target>
<note />
</trans-unit>
<trans-unit id="Make_method_async">
<source>Make method async</source>
<target state="translated">メソッドを非同期にします</target>
<note />
</trans-unit>
<trans-unit id="Make_method_async_remain_void">
<source>Make method async (stay void)</source>
<target state="translated">メソッドを非同期にする (void を維持)</target>
<note />
</trans-unit>
<trans-unit id="Name">
<source><Name></source>
<target state="translated"><名前></target>
<note />
</trans-unit>
<trans-unit id="Autoselect_disabled_due_to_member_declaration">
<source>Autoselect disabled due to member declaration</source>
<target state="translated">メンバー宣言が原因で自動選択が無効になりました</target>
<note />
</trans-unit>
<trans-unit id="Suggested_name">
<source>(Suggested name)</source>
<target state="translated">(推奨される名前)</target>
<note />
</trans-unit>
<trans-unit id="Remove_unused_function">
<source>Remove unused function</source>
<target state="translated">使用されていない関数を削除します</target>
<note />
</trans-unit>
<trans-unit id="Add_parentheses_around_conditional_expression_in_interpolated_string">
<source>Add parentheses</source>
<target state="translated">括弧を追加します</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_foreach">
<source>Convert to 'foreach'</source>
<target state="translated">'foreach' に変換する</target>
<note />
</trans-unit>
<trans-unit id="Convert_to_for">
<source>Convert to 'for'</source>
<target state="translated">'for' に変換する</target>
<note />
</trans-unit>
<trans-unit id="Invert_if">
<source>Invert if</source>
<target state="translated">if を反転する</target>
<note />
</trans-unit>
<trans-unit id="Add_Obsolete">
<source>Add [Obsolete]</source>
<target state="translated">追加 [廃止]</target>
<note />
</trans-unit>
<trans-unit id="Use_0">
<source>Use '{0}'</source>
<target state="translated">'{0}' を使用します</target>
<note />
</trans-unit>
<trans-unit id="Introduce_using_statement">
<source>Introduce 'using' statement</source>
<target state="translated">'using' ステートメントを導入します</target>
<note>{Locked="using"} "using" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="yield_break_statement">
<source>yield break statement</source>
<target state="translated">yield break ステートメント</target>
<note>{Locked="yield break"} "yield break" is a C# keyword and should not be localized.</note>
</trans-unit>
<trans-unit id="yield_return_statement">
<source>yield return statement</source>
<target state="translated">yield return ステートメント</target>
<note>{Locked="yield return"} "yield return" is a C# keyword and should not be localized.</note>
</trans-unit>
</body>
</file>
</xliff> | -1 |
dotnet/roslyn | 55,074 | Move EnC language service implementation down to EditorFeatures | Also removes old interfaces. | tmat | 2021-07-23T17:08:06Z | 2021-07-27T16:06:51Z | 4d107c3266686a06960046eadd299d3ac9b25d81 | 77e20f412539203837231ef2e31d7699b6cdffdc | Move EnC language service implementation down to EditorFeatures. Also removes old interfaces. | ./src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Storage.winmd | MZ @ !L!This program cannot be run in DOS mode.
$ PE L T " 0 & |