This commit is contained in:
David Wengier 2024-08-21 21:57:49 +10:00
Родитель 38868db9c2
Коммит ca142becdc
2 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -8,13 +8,12 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Syntax;
using Microsoft.CodeAnalysis.Razor.DocumentMapping;
using Microsoft.CodeAnalysis.Razor.Formatting;
using Microsoft.CodeAnalysis.Razor.Logging;
using Microsoft.CodeAnalysis.Razor.Protocol;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting;
namespace Microsoft.CodeAnalysis.Razor.Formatting;
internal sealed class HtmlFormattingPass(
IDocumentMappingService documentMappingService,

Просмотреть файл

@ -32,7 +32,7 @@ internal class RazorFormattingService(
FormattingOptions options,
CancellationToken cancellationToken)
{
Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html");
Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html");
var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false);
@ -130,7 +130,7 @@ internal class RazorFormattingService(
bool automaticallyAddUsings,
CancellationToken cancellationToken)
{
Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html");
Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html");
// If we only received a single edit, let's always return a single edit back.
// Otherwise, merge only if explicitly asked.