Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
be78d2f
Clean up CodeTarget infrastructure
DustinCampbell Sep 24, 2025
464497b
Clean up DocumentWriter
DustinCampbell Sep 24, 2025
147a418
Pass CancellationToken to DocumentWriter
DustinCampbell Sep 24, 2025
49d4950
Thread CancellationToken through DefaultRazorTagHelperRewritePhase
DustinCampbell Sep 24, 2025
05fa9ca
Thread CancellationToken through DefaultRazorTagHelperContextDiscover…
DustinCampbell Sep 24, 2025
1d52b9f
Thread CancellationToken through DefaultRazorSyntaxTreePhase
DustinCampbell Sep 24, 2025
d653712
Pass ImmutableArray to CSharpCodeParser rather than IEnumerable
DustinCampbell Sep 24, 2025
12c5082
Don't use ImmutableHashSet and ImmutableDictionary in CSharpCodeParser
DustinCampbell Sep 24, 2025
621258e
Clean up and improve TokenizerBackedParser and HtmlMarkupParser a bit
DustinCampbell Sep 24, 2025
190770f
Thread CancellationToken through DefaultRazorParsingPhase
DustinCampbell Sep 24, 2025
1ca30a1
Pass CancellationToken into all passes
DustinCampbell Sep 25, 2025
d28200e
Compiler phases call ThrowIfCancellationRequested in-between passes
DustinCampbell Sep 25, 2025
b7be199
RazorSourceGenerator should pass CancellationToken to compiler phases
DustinCampbell Sep 25, 2025
d90acc5
CR feedback and setting optimal capacities in CSharpCodeParser
DustinCampbell Sep 26, 2025
0a4e035
CR Feedback: Move CancellationToken checks outside of fast loops
DustinCampbell Sep 26, 2025
d55ee7a
Move DocumentWrite.WriteDocument into DefaultRazorCSharpLoweringPhase
DustinCampbell Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using System;
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Xunit;

Expand All @@ -15,14 +12,14 @@ public class CSharpAutoCompleteTest() : ParserTestBase(layer: TestProject.Layer.
public void FunctionsDirectiveAutoCompleteAtEOF()
{
// Arrange, Act & Assert
ParseDocumentTest("@functions{", new[] { FunctionsDirective.Directive });
ParseDocumentTest("@functions{", [FunctionsDirective.Directive]);
}

[Fact]
public void SectionDirectiveAutoCompleteAtEOF()
{
// Arrange, Act & Assert
ParseDocumentTest("@section Header {", new[] { SectionDirective.Directive });
ParseDocumentTest("@section Header {", [SectionDirective.Directive]);
}

[Fact]
Expand All @@ -38,7 +35,7 @@ public void FunctionsDirectiveAutoCompleteAtStartOfFile()
ParseDocumentTest("""
@functions{
foo
""", new[] { FunctionsDirective.Directive });
""", [FunctionsDirective.Directive]);
}

[Fact]
Expand All @@ -48,7 +45,7 @@ public void SectionDirectiveAutoCompleteAtStartOfFile()
ParseDocumentTest("""
@section Header {
<p>Foo</p>
""", new[] { SectionDirective.Directive });
""", [SectionDirective.Directive]);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using System;
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Xunit;

Expand Down Expand Up @@ -183,7 +180,7 @@ public void ReportsErrorIfClassBlockUnterminatedAtEOF()
{
ParseDocumentTest(
"@functions { var foo = bar; if(foo != null) { bar(); } ",
new[] { FunctionsDirective.Directive });
[FunctionsDirective.Directive]);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using Microsoft.AspNetCore.Razor.Language.Extensions;
using Xunit;

Expand Down Expand Up @@ -31,7 +29,7 @@ string GetAnnouncmentText(string message)
if (message != null) @@SomeGitHubUserName <strong>@message</strong>
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -46,7 +44,7 @@ string GetAnnouncmentText(string message)
if (message.Length > 0) return ""Anouncement: "" + message;
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -61,7 +59,7 @@ void Announcment(string message)
<h3>@message</h3>
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -76,7 +74,7 @@ void Announcment(string message)
<h3>@message</h3>
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

// This will parse correctly in Razor, but will generate invalid C#.
Expand All @@ -89,7 +87,7 @@ public void MarkupInFunctionsBlock_ParsesMarkupWithExpressionsMethod()
@functions {
void Announcment(string message) => <h3>@message</h3>
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -101,7 +99,7 @@ public void MarkupInFunctionsBlock_DoesNotParseMarkupInString()
@functions {
void Announcment(string message) => ""<h3>@message</h3>"";
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -113,7 +111,7 @@ public void MarkupInFunctionsBlock_DoesNotParseMarkupInVerbatimString()
@functions {
void Announcment(string message) => @""<h3>@message</h3>"";
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -133,7 +131,7 @@ void Announcment(string message)
</div>
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -153,7 +151,7 @@ void Announcment(string message)
</div>
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}

[Fact]
Expand All @@ -171,6 +169,6 @@ public void DoSomething()
}
}
}
", new[] { FunctionsDirective.Directive, }, designTime: false);
", [FunctionsDirective.Directive], designTime: false);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using Microsoft.AspNetCore.Razor.Language.Extensions;
using Xunit;

Expand Down Expand Up @@ -231,7 +229,7 @@ public void ParsesNullForgivenessOperatorImplicitExpression_NestedCodeBlock()
public void ParsesNullForgivenessOperatorImplicitExpression_DirectiveCodeBlock()
{
// Act & Assert
ParseDocumentTest("@functions { public void Foo() { @Model!.Name![0]!?.Bar } }", new[] { FunctionsDirective.Directive });
ParseDocumentTest("@functions { public void Foo() { @Model!.Name![0]!?.Bar } }", [FunctionsDirective.Directive]);
}

[Fact]
Expand Down
Loading