// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Syntax;
namespace Microsoft.CodeAnalysis.Razor.FoldingRanges;
internal class RazorCodeBlockFoldingProvider : AbstractSyntaxNodeFoldingProvider<RazorDirectiveSyntax>
{
protected override string GetCollapsedText(RazorDirectiveSyntax node)
{
Debug.Assert(node.HasDirectiveDescriptor);
return "@" + node.DirectiveDescriptor.Directive;
}
protected override ImmutableArray<RazorDirectiveSyntax> GetFoldableNodes(RazorSyntaxTree syntaxTree)
{
return syntaxTree.GetCodeBlockDirectives();
}
}
|