From 8de0cf0002de7e43c91df21393e1ac8e8584024e Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Thu, 7 Nov 2024 10:53:17 -0800 Subject: [PATCH] Delete ImportDocumentSnapshot now that it is unused --- .../ProjectSystem/ImportDocumentSnapshot.cs | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs deleted file mode 100644 index ae94a5e802..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Diagnostics.CodeAnalysis; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem; - -internal sealed class ImportDocumentSnapshot(IProjectSnapshot project, RazorProjectItem item) : IDocumentSnapshot -{ - public IProjectSnapshot Project { get; } = project; - - private readonly RazorProjectItem _importItem = item; - private SourceText? _text; - - // The default import file does not have a kind or paths. - public string? FileKind => null; - public string? FilePath => null; - public string? TargetPath => null; - - public int Version => 1; - - public ValueTask GetTextAsync(CancellationToken cancellationToken) - { - return TryGetText(out var text) - ? new(text) - : ReadTextAsync(); - - ValueTask ReadTextAsync() - { - using var stream = _importItem.Read(); - var sourceText = SourceText.From(stream); - - var result = _text ??= InterlockedOperations.Initialize(ref _text, sourceText); - return new(result); - } - } - - public ValueTask GetGeneratedOutputAsync( - bool forceDesignTimeGeneratedOutput, - CancellationToken cancellationToken) - => throw new NotSupportedException(); - - public ValueTask GetTextVersionAsync(CancellationToken cancellationToken) - => new(VersionStamp.Default); - - public bool TryGetText([NotNullWhen(true)] out SourceText? result) - { - result = _text; - return result is not null; - } - - public bool TryGetTextVersion(out VersionStamp result) - { - result = VersionStamp.Default; - return true; - } - - public bool TryGetGeneratedOutput([NotNullWhen(true)] out RazorCodeDocument? result) - => throw new NotSupportedException(); - - public IDocumentSnapshot WithText(SourceText text) - => throw new NotSupportedException(); - - public ValueTask GetCSharpSyntaxTreeAsync(CancellationToken cancellationToken) - => throw new NotSupportedException(); -}