diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs index d7c22409c61..42d4a8e4692 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeRenderingContext.cs @@ -37,6 +37,8 @@ public abstract class CodeRenderingContext : IDisposable public abstract void AddSourceMappingFor(SourceSpan node); + public abstract void AddGeneratedOnlyMapping(int length); + public abstract void RenderNode(IntermediateNode node); public abstract void RenderNode(IntermediateNode node, IntermediateNodeWriter writer); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs index bd31c4d5c33..f44163a72c4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriterExtensions.cs @@ -422,6 +422,7 @@ public static CSharpCodeWritingScope BuildClassDeclaration( } writer.Write("class "); + context?.AddGeneratedOnlyMapping(name.Length); writer.Write(name); if (typeParameters != null && typeParameters.Count > 0) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs index 60fb31990bd..83b7f2f3c48 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultCodeRenderingContext.cs @@ -19,6 +19,7 @@ internal class DefaultCodeRenderingContext : CodeRenderingContext private readonly List _scopes; private readonly PooledObject.Builder> _sourceMappingsBuilder; + private readonly PooledObject.Builder> _generatedOnlyMappingsBuilder; public DefaultCodeRenderingContext( CodeWriter codeWriter, @@ -61,6 +62,7 @@ public DefaultCodeRenderingContext( Diagnostics = new RazorDiagnosticCollection(); Items = new ItemCollection(); _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); + _generatedOnlyMappingsBuilder = ArrayBuilderPool.GetPooledObject(); LinePragmas = new List(); var diagnostics = _documentNode.GetAllDiagnostics(); @@ -100,6 +102,8 @@ public DefaultCodeRenderingContext( public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; + public ImmutableArray.Builder GeneratedOnlyMappings => _generatedOnlyMappingsBuilder.Object; + internal List LinePragmas { get; } public override IntermediateNodeWriter NodeWriter => Current.Writer; @@ -142,6 +146,11 @@ public override void AddSourceMappingFor(SourceSpan source) SourceMappings.Add(sourceMapping); } + public override void AddGeneratedOnlyMapping(int length) + { + GeneratedOnlyMappings.Add(new SourceSpan(CodeWriter.Location, length)); + } + public override void RenderChildren(IntermediateNode node) { if (node == null) @@ -220,6 +229,7 @@ public override void AddLinePragma(LinePragma linePragma) public override void Dispose() { _sourceMappingsBuilder.Dispose(); + _generatedOnlyMappingsBuilder.Dispose(); } private struct ScopeInternal diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs index ce0f8a336c1..2a54b36e320 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/DefaultDocumentWriter.cs @@ -53,6 +53,7 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument _options, allOrderedDiagnostics.ToArray(), context.SourceMappings.DrainToImmutable(), + context.GeneratedOnlyMappings.DrainToImmutable(), context.LinePragmas.ToArray()); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs index 381a092eba7..c31f35695ac 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/DefaultRazorCSharpDocument.cs @@ -15,6 +15,7 @@ internal class DefaultRazorCSharpDocument : RazorCSharpDocument private readonly string _generatedCode; private readonly RazorDiagnostic[] _diagnostics; private readonly ImmutableArray _sourceMappings; + private readonly ImmutableArray _generatedOnlyMappings; private readonly LinePragma[] _linePragmas; private readonly RazorCodeGenerationOptions _options; private readonly RazorCodeDocument _codeDocument; @@ -25,6 +26,7 @@ public DefaultRazorCSharpDocument( RazorCodeGenerationOptions options, RazorDiagnostic[] diagnostics, ImmutableArray sourceMappings, + ImmutableArray generatedOnlyMappings, LinePragma[] linePragmas) { if (generatedCode == null) @@ -43,6 +45,7 @@ public DefaultRazorCSharpDocument( _diagnostics = diagnostics ?? Array.Empty(); _sourceMappings = sourceMappings; + _generatedOnlyMappings = generatedOnlyMappings; _linePragmas = linePragmas ?? Array.Empty(); } @@ -52,6 +55,8 @@ public DefaultRazorCSharpDocument( public override ImmutableArray SourceMappings => _sourceMappings; + public override ImmutableArray GeneratedOnlyMappings => _generatedOnlyMappings; + internal override IReadOnlyList LinePragmas => _linePragmas; public override RazorCodeGenerationOptions Options => _options; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/IRazorGeneratedDocument.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/IRazorGeneratedDocument.cs index 94e5011349c..325890fb8b5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/IRazorGeneratedDocument.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/IRazorGeneratedDocument.cs @@ -10,5 +10,6 @@ internal interface IRazorGeneratedDocument string GeneratedCode { get; } RazorCodeGenerationOptions Options { get; } ImmutableArray SourceMappings { get; } + ImmutableArray GeneratedOnlyMappings { get; } RazorCodeDocument? CodeDocument { get; } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt index 21c5a6c59f3..3b14a352224 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/PublicAPI.Unshipped.txt @@ -8,6 +8,7 @@ *REMOVED*~Microsoft.AspNetCore.Razor.Language.TagHelperDescriptor.TagMatchingRules.get -> System.Collections.Generic.IReadOnlyList *REMOVED*~Microsoft.AspNetCore.Razor.Language.TagMatchingRuleDescriptor.Attributes.get -> System.Collections.Generic.IReadOnlyList *REMOVED*~virtual Microsoft.AspNetCore.Razor.Language.BoundAttributeDescriptor.BoundAttributeParameters.get -> System.Collections.Generic.IReadOnlyList +abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.AddGeneratedOnlyMapping(int length) -> void abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.AddSourceMappingFor(Microsoft.AspNetCore.Razor.Language.SourceSpan node) -> void abstract Microsoft.AspNetCore.Razor.Language.CodeGeneration.CodeRenderingContext.Dispose() -> void abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.ContainsKey(string! key) -> bool @@ -17,6 +18,7 @@ abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.Keys.get -> Syst abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.this[string! key].get -> string? abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.TryGetValue(string! key, out string? value) -> bool abstract Microsoft.AspNetCore.Razor.Language.MetadataCollection.Values.get -> System.Collections.Generic.IEnumerable! +abstract Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.GeneratedOnlyMappings.get -> System.Collections.Immutable.ImmutableArray abstract Microsoft.AspNetCore.Razor.Language.RazorSourceDocumentProperties.FilePath.get -> string? abstract Microsoft.AspNetCore.Razor.Language.RazorSourceDocumentProperties.RelativePath.get -> string? abstract Microsoft.AspNetCore.Razor.Language.TagHelperCollector.Collect(Microsoft.CodeAnalysis.ISymbol! symbol, System.Collections.Generic.ICollection! results) -> void @@ -365,7 +367,7 @@ virtual Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.OnInitialized() ~static Microsoft.AspNetCore.Razor.Language.RazorCodeDocumentExtensions.SetImportSyntaxTrees(this Microsoft.AspNetCore.Razor.Language.RazorCodeDocument document, System.Collections.Immutable.ImmutableArray syntaxTrees) -> void ~static Microsoft.AspNetCore.Razor.Language.RazorCodeDocumentExtensions.SetPreTagHelperSyntaxTree(this Microsoft.AspNetCore.Razor.Language.RazorCodeDocument document, Microsoft.AspNetCore.Razor.Language.RazorSyntaxTree syntaxTree) -> void ~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable diagnostics) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument -~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable diagnostics, System.Collections.Immutable.ImmutableArray sourceMappings, System.Collections.Generic.IEnumerable linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument +~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(Microsoft.AspNetCore.Razor.Language.RazorCodeDocument codeDocument, string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable diagnostics, System.Collections.Immutable.ImmutableArray sourceMappings, System.Collections.Immutable.ImmutableArray generatedOnlyMappings, System.Collections.Generic.IEnumerable linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument ~static Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument.Create(string generatedCode, Microsoft.AspNetCore.Razor.Language.RazorCodeGenerationOptions options, System.Collections.Generic.IEnumerable diagnostics, System.Collections.Immutable.ImmutableArray sourceMappings, System.Collections.Generic.IEnumerable linePragmas) -> Microsoft.AspNetCore.Razor.Language.RazorCSharpDocument ~static Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilderExtensions.SetMetadata(this Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilder builder, System.Collections.Generic.KeyValuePair pair) -> void ~static Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilderExtensions.SetMetadata(this Microsoft.AspNetCore.Razor.Language.TagHelperDescriptorBuilder builder, System.Collections.Generic.KeyValuePair pair1, System.Collections.Generic.KeyValuePair pair2) -> void diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs index fc16701d2f7..76cad11cca1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorCSharpDocument.cs @@ -17,6 +17,14 @@ public abstract class RazorCSharpDocument : IRazorGeneratedDocument public abstract ImmutableArray SourceMappings { get; } + /// + /// Maps spans from the generated source to the whole component. + /// + /// + /// Used to map the component class name, so go-to-definition navigates to the .razor file. + /// + public abstract ImmutableArray GeneratedOnlyMappings { get; } + public abstract IReadOnlyList Diagnostics { get; } public abstract RazorCodeGenerationOptions Options { get; } @@ -31,7 +39,7 @@ public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerati [Obsolete("For backwards compatibility only. Use the overload that takes a RazorCodeDocument")] public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics, ImmutableArray sourceMappings, IEnumerable linePragmas) - => Create(codeDocument: null, generatedCode, options, diagnostics, sourceMappings, linePragmas); + => Create(codeDocument: null, generatedCode, options, diagnostics, sourceMappings, ImmutableArray.Empty, linePragmas); public static RazorCSharpDocument Create(RazorCodeDocument codeDocument, string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) { @@ -50,7 +58,7 @@ public static RazorCSharpDocument Create(RazorCodeDocument codeDocument, string throw new ArgumentNullException(nameof(diagnostics)); } - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray.Empty, linePragmas: null); + return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray.Empty, generatedOnlyMappings: ImmutableArray.Empty, linePragmas: null); } public static RazorCSharpDocument Create( @@ -59,6 +67,7 @@ public static RazorCSharpDocument Create( RazorCodeGenerationOptions options, IEnumerable diagnostics, ImmutableArray sourceMappings, + ImmutableArray generatedOnlyMappings, IEnumerable linePragmas) { if (generatedCode == null) @@ -76,6 +85,6 @@ public static RazorCSharpDocument Create( throw new ArgumentNullException(nameof(diagnostics)); } - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas.ToArray()); + return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, generatedOnlyMappings, linePragmas.ToArray()); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs index af602a2df7d..7b39fdb659d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/RazorHtmlDocument.cs @@ -16,6 +16,8 @@ internal abstract class RazorHtmlDocument : IRazorGeneratedDocument public abstract ImmutableArray SourceMappings { get; } + public ImmutableArray GeneratedOnlyMappings => ImmutableArray.Empty; + public abstract RazorCodeDocument CodeDocument { get; } public static RazorHtmlDocument Create(RazorCodeDocument codeDocument, string generatedHtml, RazorCodeGenerationOptions options, ImmutableArray sourceMappings) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 01198aef466..9c8f8ba9dca 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -61,6 +61,7 @@ public void Setup() RazorCodeGenerationOptions.CreateDesignTimeDefault(), Array.Empty(), SourceMappings, + ImmutableArray.Empty, new List() ); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs index b39f897c151..37433b42a8e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorDocumentMappingService.cs @@ -332,6 +332,19 @@ public bool TryMapToHostDocumentPosition(IRazorGeneratedDocument generatedDocume return true; } + foreach (var mapping in generatedDocument.GeneratedOnlyMappings) + { + var generatedAbsoluteIndex = mapping.AbsoluteIndex; + var distanceIntoGeneratedSpan = generatedDocumentIndex - generatedAbsoluteIndex; + if (generatedAbsoluteIndex <= generatedDocumentIndex && + distanceIntoGeneratedSpan <= mapping.Length) + { + hostDocumentIndex = 0; + hostDocumentPosition = new LinePosition(0, 0); + return true; + } + } + hostDocumentPosition = default; hostDocumentIndex = default; return false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index 2f188d25cb5..bbc9fa046a5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -159,10 +159,14 @@ private async Task AddCSharpSpellCheckRangesAsync(List ranges, // We need to map the start index to produce results, and we validate that we can map the end index so we don't have // squiggles that go from C# into Razor/Html. - if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) && - _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3)) + if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentStartIndex) && + _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var hostDocumentEndIndex)) { - ranges.Add(new(kind, hostDocumentIndex, length)); + var mappedLength = hostDocumentEndIndex - hostDocumentStartIndex; + if (mappedLength > 0) + { + ranges.Add(new(kind, hostDocumentStartIndex, mappedLength)); + } } absoluteCSharpStartIndex += length; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs index 3a54742da82..48c3448e01f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs @@ -95,6 +95,18 @@ internal static bool TryGetMappedSpans(TextSpan span, SourceText source, RazorCS } } + foreach (var mapping in output.GeneratedOnlyMappings) + { + var generated = mapping.AsTextSpan(); + + if (generated.Contains(span)) + { + mappedSpan = new TextSpan(0, 0); + linePositionSpan = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 0)); + return true; + } + } + mappedSpan = default; linePositionSpan = default; return false; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs index ab5c003fe9d..13663923728 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorTranslateDiagnosticsEndpointTest.cs @@ -1215,6 +1215,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection( RazorCodeGenerationOptions.CreateDefault(), Enumerable.Empty(), sourceMappings.ToImmutableArray(), + ImmutableArray.Empty, Enumerable.Empty()); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs index 0bb5e5506c0..d4cb08d2e4f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs @@ -22,7 +22,7 @@ public class DocumentSymbolEndpointTest(ITestOutputHelper testOutput) : SingleSe public Task DocumentSymbols_CSharpMethods() => VerifyDocumentSymbolsAsync( """ - @functions { + {|AspNetCore.test:|}@functions { private void {|HandleString(string s):HandleString|}(string s) { s += "Hello"; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 8d7b6102d96..7a66322b3be 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -23,7 +23,7 @@ internal static RazorCodeDocument CreateCodeDocument(string content, IReadOnlyLi var codeDocument = RazorCodeDocument.Create(sourceDocument); var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, RazorParserOptions.CreateDefault()); var razorCSharpDocument = RazorCSharpDocument.Create( - codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), Array.Empty(), sourceMappings.ToImmutableArray(), Array.Empty()); + codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), Array.Empty(), sourceMappings.ToImmutableArray(), ImmutableArray.Empty, Array.Empty()); codeDocument.SetSyntaxTree(syntaxTree); codeDocument.SetCSharpDocument(razorCSharpDocument); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs index 6651e144593..0e018e6d169 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs @@ -149,6 +149,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r RazorCodeGenerationOptions.CreateDefault(), Enumerable.Empty(), sourceMappings.ToImmutableArray(), + ImmutableArray.Empty, Enumerable.Empty()); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index dc758e7a0a0..ef38925a353 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -260,6 +260,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r RazorCodeGenerationOptions.CreateDefault(), Enumerable.Empty(), sourceMappings.ToImmutableArray(), + ImmutableArray.Empty, Enumerable.Empty()); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index 116b1a8d1d9..e6b7ab5d65d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -1084,6 +1084,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r RazorCodeGenerationOptions.CreateDefault(), Enumerable.Empty(), sourceMappings.ToImmutableArray(), + ImmutableArray.Empty, Enumerable.Empty()); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument;