16 instantiations of SumType
Microsoft.CodeAnalysis.LanguageServer.Protocol (14)
Handler\Hover\HoverHandler.cs (1)
124
Contents = new
SumType
<string, MarkedString, SumType<string, MarkedString>[], MarkupContent>(string.Empty),
Protocol\SumType.cs (13)
573
public static implicit operator SumType<T1, T2, T3, T4>(T1 val) =>
new
(val);
579
public static implicit operator SumType<T1, T2, T3, T4>?(T1? val) => val is null ? null : new
SumType
<T1, T2, T3, T4>(val);
585
public static implicit operator SumType<T1, T2, T3, T4>(T2 val) =>
new
(val);
591
public static implicit operator SumType<T1, T2, T3, T4>?(T2? val) => val is null ? null : new
SumType
<T1, T2, T3, T4>(val);
597
public static implicit operator SumType<T1, T2, T3, T4>(T3 val) =>
new
(val);
603
public static implicit operator SumType<T1, T2, T3, T4>?(T3? val) => val is null ? null : new
SumType
<T1, T2, T3, T4>(val);
609
public static implicit operator SumType<T1, T2, T3, T4>(T4 val) =>
new
(val);
615
public static implicit operator SumType<T1, T2, T3, T4>?(T4? val) => val is null ? null : new
SumType
<T1, T2, T3, T4>(val);
623
(v) => new
SumType
<T1, T2, T3, T4>(v),
624
(v) => new
SumType
<T1, T2, T3, T4>(v));
632
(v) => new
SumType
<T1, T2, T3, T4>(v),
633
(v) => new
SumType
<T1, T2, T3, T4>(v),
634
(v) => new
SumType
<T1, T2, T3, T4>(v));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
CodeActions\CodeActionResolveTests.cs (1)
603
locations => new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>(new RenameFile() { OldDocumentUri = locations.oldUri, NewDocumentUri = locations.newUri })).ToArray()
Microsoft.CodeAnalysis.Razor.Workspaces (1)
Extensions\LspExtensions_WorkspaceEdit.cs (1)
104
builder.Add(new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>(textDocumentEdit));
108 references to SumType
Microsoft.AspNetCore.Razor.Test.Common.Tooling (4)
AssertExtensions.cs (4)
38
foreach (
var
change in Flatten(changes))
92
static IEnumerable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> Flatten(SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> documentChanges)
103
foreach (
var
change in changes)
Microsoft.CodeAnalysis.LanguageServer (2)
LanguageServer\Handler\CopilotCompletion\ContextResolveParam.cs (2)
26
public Dictionary<string,
SumType
<string, int, bool, string[]>>? ActiveExperiments { get; set; }
43
private static object UnpackSumType(
SumType
<string, int, bool, string[]> sumType)
Microsoft.CodeAnalysis.LanguageServer.Protocol (58)
Handler\CodeActions\CodeActionResolveHelper.cs (1)
47
using var _1 = ArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>.GetInstance(out var textDocumentEdits);
Handler\Rename\WillRenameHandler.cs (2)
32
using var _2 = ArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>.GetInstance(out var documentChangesBuilder);
67
foreach (
var
sumType in sumTypes)
Protocol\Hover.cs (1)
23
public
SumType
<string, MarkedString, SumType<string, MarkedString>[], MarkupContent> Contents { get; set; }
Protocol\Internal\VSInternalHover.cs (2)
33
public new
SumType
<string, MarkedString, SumType<string, MarkedString>[], MarkupContent>? Contents
35
get => contentsIsNull ? (
SumType
<string, MarkedString, SumType<string, MarkedString>[], MarkupContent>?)null : base.Contents;
Protocol\SumType.cs (51)
496
internal struct SumType<T1, T2, T3, T4> : ISumType, IEquatable<
SumType
<T1, T2, T3, T4>>
511
/// Initializes a new instance of the <see cref="
SumType
{T1, T2, T3, T4}"/> struct containing a <typeparamref name="T1"/>.
513
/// <param name="val">The value to store in the <see cref="
SumType
{T1, T2, T3, T4}"/>.</param>
520
/// Initializes a new instance of the <see cref="
SumType
{T1, T2, T3, T4}"/> struct containing a <typeparamref name="T2"/>.
522
/// <param name="val">The value to store in the <see cref="
SumType
{T1, T2, T3, T4}"/>.</param>
529
/// Initializes a new instance of the <see cref="
SumType
{T1, T2, T3, T4}"/> struct containing a <typeparamref name="T3"/>.
531
/// <param name="val">The value to store in the <see cref="
SumType
{T1, T2, T3, T4}"/>.</param>
538
/// Initializes a new instance of the <see cref="
SumType
{T1, T2, T3, T4}"/> struct containing a <typeparamref name="T4"/>.
540
/// <param name="val">The value to store in the <see cref="
SumType
{T1, T2, T3, T4}"/>.</param>
570
/// Implicitly wraps a value of type <typeparamref name="T1"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
573
public static implicit operator
SumType
<T1, T2, T3, T4>(T1 val) => new(val);
576
/// Implicitly wraps a value of type <typeparamref name="T1?"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
579
public static implicit operator
SumType
<T1, T2, T3, T4>?(T1? val) => val is null ? null : new SumType<T1, T2, T3, T4>(val);
582
/// Implicitly wraps a value of type <typeparamref name="T2"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
585
public static implicit operator
SumType
<T1, T2, T3, T4>(T2 val) => new(val);
588
/// Implicitly wraps a value of type <typeparamref name="T2?"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
591
public static implicit operator
SumType
<T1, T2, T3, T4>?(T2? val) => val is null ? null : new SumType<T1, T2, T3, T4>(val);
594
/// Implicitly wraps a value of type <typeparamref name="T3"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
597
public static implicit operator
SumType
<T1, T2, T3, T4>(T3 val) => new(val);
600
/// Implicitly wraps a value of type <typeparamref name="T3?"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
603
public static implicit operator
SumType
<T1, T2, T3, T4>?(T3? val) => val is null ? null : new SumType<T1, T2, T3, T4>(val);
606
/// Implicitly wraps a value of type <typeparamref name="T4"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
609
public static implicit operator
SumType
<T1, T2, T3, T4>(T4 val) => new(val);
612
/// Implicitly wraps a value of type <typeparamref name="T4?"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
615
public static implicit operator
SumType
<T1, T2, T3, T4>?(T4? val) => val is null ? null : new SumType<T1, T2, T3, T4>(val);
618
/// Implicitly wraps an instance of <see cref="SumType{A, B}"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
621
public static implicit operator
SumType
<T1, T2, T3, T4>(SumType<T1, T2> sum)
627
/// Implicitly wraps an instance of <see cref="SumType{T1, T2, T3}"/> with a <see cref="
SumType
{T1, T2, T3, T4}"/>.
630
public static implicit operator
SumType
<T1, T2, T3, T4>(SumType<T1, T2, T3> sum)
637
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> into a <see cref="SumType{T1, T2}"/>.
640
public static explicit operator SumType<T1, T2>(
SumType
<T1, T2, T3, T4> sum)
656
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> into a <see cref="SumType{T1, T2, T3}"/>.
659
public static explicit operator SumType<T1, T2, T3>(
SumType
<T1, T2, T3, T4> sum)
680
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> to an instance of <typeparamref name="T1"/>.
682
/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="
SumType
{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T1"/>.</exception>
684
public static explicit operator T1(
SumType
<T1, T2, T3, T4> sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException();
687
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> to an instance of <typeparamref name="T2"/>.
689
/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="
SumType
{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T2"/>.</exception>
691
public static explicit operator T2(
SumType
<T1, T2, T3, T4> sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException();
694
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> to an instance of <typeparamref name="T3"/>.
696
/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="
SumType
{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T3"/>.</exception>
698
public static explicit operator T3(
SumType
<T1, T2, T3, T4> sum) => sum.Value is T3 tVal ? tVal : throw new InvalidCastException();
701
/// Attempts to cast an instance of <see cref="
SumType
{T1, T2, T3, T4}"/> to an instance of <typeparamref name="T4"/>.
703
/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="
SumType
{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T4"/>.</exception>
705
public static explicit operator T4(
SumType
<T1, T2, T3, T4> sum) => sum.Value is T4 tVal ? tVal : throw new InvalidCastException();
707
public static bool operator ==(
SumType
<T1, T2, T3, T4> left,
SumType
<T1, T2, T3, T4> right)
712
public static bool operator !=(
SumType
<T1, T2, T3, T4> left,
SumType
<T1, T2, T3, T4> right)
853
return obj is
SumType
<T1, T2, T3, T4> type && this.Equals(type);
857
public bool Equals(
SumType
<T1, T2, T3, T4> other)
Protocol\WorkspaceEdit.cs (1)
42
public SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]>? DocumentChanges { get; set; }
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
CodeActions\CodeActionResolveTests.cs (2)
357
DocumentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]
488
DocumentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]
Rename\WillRenameTests.cs (2)
100
DocumentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] {
107
listeners[1].Result = new WorkspaceEdit() { DocumentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] { new RenameFile() { OldDocumentUri = new("file://file2.cs") } } };
Microsoft.CodeAnalysis.Razor.Workspaces (37)
CodeActions\CSharp\UnformattedRemappingCSharpCodeActionResolver.cs (1)
43
var
documentChanged = codeAction.Edit.DocumentChanges.Value.First();
CodeActions\Razor\CreateComponentCodeActionResolver.cs (2)
44
using var documentChanges = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
55
private static void TryAddNamespaceDirective(RazorCodeDocument codeDocument, Uri newComponentUri, ref PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> documentChanges)
CodeActions\Razor\ExtractToCodeBehindCodeActionResolver.cs (1)
59
var documentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]
CodeActions\Razor\ExtractToComponentCodeActionResolver.cs (1)
81
var documentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]
CodeActions\Razor\ExtractToCssCodeActionResolver.cs (1)
51
using var changes = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>(capacity: 3);
CodeActions\Razor\PromoteUsingCodeActionResolver.cs (1)
44
using var edits = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
CodeActions\Razor\WrapAttributesCodeActionResolver.cs (1)
48
DocumentChanges = new SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]>([tde])
DocumentMapping\RazorEditService_WorkspaceEdit.cs (2)
23
using var builder = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
24
foreach (
var
edit in workspaceEdit.EnumerateEdits())
Extensions\LspExtensions_SumTypes.cs (14)
12
internal static int Count(this SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> sumType)
27
internal static
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile> ElementAt(this SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> sumType, int elementIndex)
39
return Assumed.Unreachable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
42
internal static
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] ToArray(this SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> sumType)
46
return textDocumentEdit.Select(s => (
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>)s).ToArray();
54
return Assumed.Unreachable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]>();
57
internal static
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile> First(this SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> sumType)
69
return Assumed.Unreachable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
72
internal static
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile> Last(this SumType<TextDocumentEdit[],
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]> sumType)
84
return Assumed.Unreachable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
Extensions\LspExtensions_WorkspaceEdit.cs (8)
29
else if (workspaceEdit.DocumentChanges?.Value is
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] sumTypeArray)
31
foreach (
var
sumType in sumTypeArray)
41
public static IEnumerable<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> EnumerateEdits(this WorkspaceEdit workspaceEdit)
50
else if (workspaceEdit.DocumentChanges?.Value is
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] sumTypeArray)
52
foreach (
var
edit in sumTypeArray)
66
using var builder = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
76
static void AddEdits(ref PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> builder, WorkspaceEdit edit)
85
else if (edit.DocumentChanges?.Value is
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[] sumTypeArray)
Rename\RenameService.cs (5)
69
using var documentChanges = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
76
foreach (
var
documentChange in documentChanges)
99
using var documentChanges = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
117
ref PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> documentChanges,
125
ref PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>> documentChanges)
Microsoft.CodeAnalysis.Remote.Razor (1)
NestedFiles\RemoteAddNestedFileService.cs (1)
67
var documentChanges = new
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>[]
Microsoft.VisualStudio.LanguageServices.Razor (2)
LanguageClient\Cohost\CohostApplyRenameEditEndpoint.cs (2)
69
var documentChanges = new PooledArrayBuilder<
SumType
<TextDocumentEdit, CreateFile, RenameFile, DeleteFile>>();
74
foreach (
var
edit in request.Edit.EnumerateEdits())