Skip to content

Commit a84a61a

Browse files
Add ProjectSnapshotManager extension methods that take DocumentKey
- Add ProjectSnapshotManager.ContainsDocument(DocumentKey) extension method - Add ProjectSnapshotManager.TryGetDocument(DocumentKey, ...) extension method - Add ProjectSnapshotManager.GetDocument(DocumentKey) extension method - Add ProjectSnapshotManager.GetRequiredDocument(DocumentKey) extension method - Add ProjectSnapshotManager.Updater.ContainsDocument(DocumentKey) extension method - Add ProjectSnapshotManager.Updater.TryGetDocument(DocumentKey, ...) extension method - Add ProjectSnapshotManager.Updater.GetDocument(DocumentKey) extension method - Add ProjectSnapshotManager.Updater.GetRequiredDocument(DocumentKey) extension method
1 parent 965a5d9 commit a84a61a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerExtensions.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ public static bool TryGetDocument(
4242
public static DocumentSnapshot GetRequiredDocument(this ProjectSnapshotManager projectManager, ProjectKey projectKey, string documentFilePath)
4343
=> projectManager.GetDocument(projectKey, documentFilePath).AssumeNotNull();
4444

45+
public static bool ContainsDocument(this ProjectSnapshotManager projectManager, DocumentKey documentKey)
46+
=> projectManager.ContainsDocument(documentKey.ProjectKey, documentKey.FilePath);
47+
48+
public static bool TryGetDocument(
49+
this ProjectSnapshotManager projectManager,
50+
DocumentKey documentKey,
51+
[NotNullWhen(true)] out DocumentSnapshot? document)
52+
=> projectManager.TryGetDocument(documentKey.ProjectKey, documentKey.FilePath, out document);
53+
54+
public static DocumentSnapshot? GetDocument(this ProjectSnapshotManager projectManager, DocumentKey documentKey)
55+
=> projectManager.GetDocument(documentKey.ProjectKey, documentKey.FilePath);
56+
57+
public static DocumentSnapshot GetRequiredDocument(this ProjectSnapshotManager projectManager, DocumentKey documentKey)
58+
=> projectManager.GetRequiredDocument(documentKey.ProjectKey, documentKey.FilePath);
59+
4560
public static ProjectSnapshot? GetProject(this ProjectSnapshotManager.Updater updater, ProjectKey projectKey)
4661
=> updater.TryGetProject(projectKey, out var result)
4762
? result
@@ -74,4 +89,19 @@ public static bool TryGetDocument(
7489

7590
public static DocumentSnapshot GetRequiredDocument(this ProjectSnapshotManager.Updater updater, ProjectKey projectKey, string documentFilePath)
7691
=> updater.GetDocument(projectKey, documentFilePath).AssumeNotNull();
92+
93+
public static bool ContainsDocument(this ProjectSnapshotManager.Updater updater, DocumentKey documentKey)
94+
=> updater.ContainsDocument(documentKey.ProjectKey, documentKey.FilePath);
95+
96+
public static bool TryGetDocument(
97+
this ProjectSnapshotManager.Updater updater,
98+
DocumentKey documentKey,
99+
[NotNullWhen(true)] out DocumentSnapshot? document)
100+
=> updater.TryGetDocument(documentKey.ProjectKey, documentKey.FilePath, out document);
101+
102+
public static DocumentSnapshot? GetDocument(this ProjectSnapshotManager.Updater updater, DocumentKey documentKey)
103+
=> updater.GetDocument(documentKey.ProjectKey, documentKey.FilePath);
104+
105+
public static DocumentSnapshot GetRequiredDocument(this ProjectSnapshotManager.Updater updater, DocumentKey documentKey)
106+
=> updater.GetRequiredDocument(documentKey.ProjectKey, documentKey.FilePath);
77107
}

0 commit comments

Comments
 (0)