-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
ProjectOrDocumentId.cs
38 lines (32 loc) · 1.34 KB
/
ProjectOrDocumentId.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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.Diagnostics.CodeAnalysis;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics;
/// <summary>
/// Wrapper around project and document ids for convenience in caching diagnostic results and
/// use in the <see cref="IDiagnosticSource"/>
/// </summary>
internal readonly struct ProjectOrDocumentId
{
/// <summary>
/// Non-null if this represents a documentId. Used for equality comparisons.
/// </summary>
[SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Used for equality comparison.")]
private readonly DocumentId? _documentId;
/// <summary>
/// Non-null if this represents a projectId. Used for equality comparisons.
/// </summary>
[SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "Used for equality comparison.")]
private readonly ProjectId? _projectId;
public ProjectOrDocumentId(ProjectId projectId)
{
_projectId = projectId;
_documentId = null;
}
public ProjectOrDocumentId(DocumentId documentId)
{
_documentId = documentId;
_projectId = null;
}
}