diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs index e993d979323..dc69e6658e7 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs @@ -55,9 +55,40 @@ Eat more chickin. await VerifySpellCheckableRangesAsync(input); } - private async Task VerifySpellCheckableRangesAsync(TestCode input) + [Fact] + public async Task ComponentAttributes() + { + await VerifySpellCheckableRangesAsync( + input: """ + + + +
+ + + + @code + { + private string? [|InputValue|] { get; set; } + } + """, + additionalFiles: [ + (FilePath("SurveyPrompt.razor"), """ + @namespace SomeProject + +
+ + @code + { + [Parameter] + public string Title { get; set; } + } + """)]); + } + + private async Task VerifySpellCheckableRangesAsync(TestCode input, (string file, string contents)[]? additionalFiles = null) { - var document = CreateProjectAndRazorDocument(input.Text); + var document = CreateProjectAndRazorDocument(input.Text, additionalFiles: additionalFiles); var sourceText = await document.GetTextAsync(DisposalToken); var endpoint = new CohostDocumentSpellCheckEndpoint(IncompatibleProjectService, RemoteServiceInvoker); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs index f2e25c8389d..490bba93d68 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs @@ -101,6 +101,25 @@ await VerifyOnTypeFormattingAsync( html: true); } + [Fact] + public async Task FormattingDisabled() + { + ClientSettingsManager.Update(ClientSettingsManager.GetClientSettings().AdvancedSettings with { FormatOnType = false }); + + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if(true){} + } + """, + triggerCharacter: '}'); + } + private async Task VerifyOnTypeFormattingAsync(TestCode input, string expected, char triggerCharacter, bool html = false) { var document = CreateProjectAndRazorDocument(input.Text); @@ -126,9 +145,7 @@ private async Task VerifyOnTypeFormattingAsync(TestCode input, string expected, requestInvoker = StrictMock.Of(); } - var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); - - var endpoint = new CohostOnTypeFormattingEndpoint(IncompatibleProjectService, RemoteServiceInvoker, requestInvoker, clientSettingsManager, LoggerFactory); + var endpoint = new CohostOnTypeFormattingEndpoint(IncompatibleProjectService, RemoteServiceInvoker, requestInvoker, ClientSettingsManager, LoggerFactory); var request = new DocumentOnTypeFormattingParams() { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs index 23479a05421..84f39e95216 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Test.Common; @@ -99,7 +100,33 @@ private void M(string thisIsMyString) } """); - private async Task VerifyRangeFormattingAsync(TestCode input, string expected) + [Fact] + public async Task FormatOnPasteDisabled() + { + ClientSettingsManager.Update(ClientSettingsManager.GetClientSettings().AdvancedSettings with { FormatOnPaste = false }); + + await VerifyRangeFormattingAsync( + input: """ +
+ [|hello +
+
|] +
+ """, + expected: """ +
+ hello +
+
+
+ """, + otherOptions: new() + { + { "fromPaste", true } + }); + } + + private async Task VerifyRangeFormattingAsync(TestCode input, string expected, Dictionary>? otherOptions = null) { var document = CreateProjectAndRazorDocument(input.Text); var inputText = await document.GetTextAsync(DisposalToken); @@ -114,9 +141,7 @@ private async Task VerifyRangeFormattingAsync(TestCode input, string expected) var requestInvoker = new TestHtmlRequestInvoker([(Methods.TextDocumentFormattingName, htmlEdits)]); - var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); - - var endpoint = new CohostRangeFormattingEndpoint(IncompatibleProjectService, RemoteServiceInvoker, requestInvoker, clientSettingsManager, LoggerFactory); + var endpoint = new CohostRangeFormattingEndpoint(IncompatibleProjectService, RemoteServiceInvoker, requestInvoker, ClientSettingsManager, LoggerFactory); var request = new DocumentRangeFormattingParams() { @@ -124,13 +149,20 @@ private async Task VerifyRangeFormattingAsync(TestCode input, string expected) Options = new FormattingOptions() { TabSize = 4, - InsertSpaces = true + InsertSpaces = true, + OtherOptions = otherOptions }, Range = inputText.GetRange(input.Span) }; var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + if (edits is null or []) + { + Assert.Equal(input.Text, expected); + return; + } + var changes = edits.Select(inputText.GetTextChange); var finalText = inputText.WithChanges(changes); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostValidateBreakableRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostValidateBreakableRangeEndpointTest.cs index c77635f9a54..5a14947ebb3 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostValidateBreakableRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostValidateBreakableRangeEndpointTest.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; using Xunit; using Xunit.Abstractions; diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/CascadingTypeParameterFormattingTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/CascadingTypeParameterFormattingTest.cs new file mode 100644 index 00000000000..5e5ac7ee9df --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/CascadingTypeParameterFormattingTest.cs @@ -0,0 +1,203 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.Razor.LanguageClient.Cohost; +using Microsoft.VisualStudio.Razor.LanguageClient.Cohost.Formatting; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.Test.Cohost.Formatting; + +[Collection(HtmlFormattingCollection.Name)] +public class CascadingTypeParameterFormattingTest(FormattingTestContext context, HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(context, fixture.Service, testOutput), IClassFixture +{ + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor-tooling/issues/5648")] + public async Task GenericComponentWithCascadingTypeParameter() + { + await RunFormattingTestAsync( + input: """ + @page "/counter" + + @if(true) + { + // indented + } + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+ + @if(true) + { + // indented + } + + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + } + """, + expected: """ + @page "/counter" + + @if (true) + { + // indented + } + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+ + @if (true) + { + // indented + } + + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + } + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor-tooling/issues/5648")] + public async Task GenericComponentWithCascadingTypeParameter_Nested() + { + await RunFormattingTestAsync( + input: """ + @page "/counter" + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+
+ + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + } + """, + expected: """ + @page "/counter" + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+
+ + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + } + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor-tooling/issues/5648")] + public async Task GenericComponentWithCascadingTypeParameter_MultipleParameters() + { + await RunFormattingTestAsync( + input: """ + @page "/counter" + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+ + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + private IEnumerable _items2 = new long[] { 1, 2, 3, 4, 5 }; + } + """, + expected: """ + @page "/counter" + + + @foreach (var v in System.Linq.Enumerable.Range(1, 10)) + { +
+ } +
+ + @code + { + private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; + private IEnumerable _items2 = new long[] { 1, 2, 3, 4, 5 }; + } + """); + } + + private Task RunFormattingTestAsync( + TestCode input, + string expected) + { + return base.RunFormattingTestAsync( + input, + expected, + additionalFiles: [ + (FilePath("TestGeneric.razor"), """ + @using System.Collections.Generic + @using Microsoft.AspNetCore.Components + @typeparam TItem + @attribute [CascadingTypeParameter(nameof(TItem))] + +

TestGeneric

+ + @code + { + [Parameter] public IEnumerable Items { get; set; } + [Parameter] public RenderFragment ChildContent { get; set; } + } + """), + (FilePath("TestGenericTwo.razor"), """ + @using System.Collections.Generic + @using Microsoft.AspNetCore.Components + @typeparam TItem + @typeparam TItemTwo + @attribute [CascadingTypeParameter(nameof(TItem))] + @attribute [CascadingTypeParameter(nameof(TItemTwo))] + +

TestGeneric

+ + @code + { + [Parameter] public IEnumerable Items { get; set; } + [Parameter] public IEnumerable ItemsTwo { get; set; } + [Parameter] public RenderFragment ChildContent { get; set; } + } + """)]); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/FormattingTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/FormattingTestBase.cs index 8119b4906aa..ec4a0569e77 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/FormattingTestBase.cs @@ -45,11 +45,12 @@ private protected async Task RunFormattingTestAsync( int tabSize = 4, bool allowDiagnostics = false, bool debugAssertsEnabled = true, - RazorCSharpSyntaxFormattingOptions? csharpSyntaxFormattingOptions = null) + RazorCSharpSyntaxFormattingOptions? csharpSyntaxFormattingOptions = null, + (string fileName, string contents)[]? additionalFiles = null) { (input, expected) = ProcessFormattingContext(input, expected); - var document = CreateProjectAndRazorDocument(input.Text, fileKind, inGlobalNamespace: inGlobalNamespace); + var document = CreateProjectAndRazorDocument(input.Text, fileKind, inGlobalNamespace: inGlobalNamespace, additionalFiles: additionalFiles); if (!allowDiagnostics) { //TODO: Tests in LanguageServer have extra components that are not present in this project, like Counter, etc. diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingPassTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingPassTest.cs index c1174daa242..d5d16db81d0 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingPassTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingPassTest.cs @@ -1,19 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; -using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.CodeAnalysis.ExternalAccess.Razor.Features; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Remote.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Razor.LanguageClient.Cohost; diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingTest.cs new file mode 100644 index 00000000000..28a4c998049 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/Formatting/HtmlFormattingTest.cs @@ -0,0 +1,496 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.Razor.LanguageClient.Cohost; +using Microsoft.VisualStudio.Razor.LanguageClient.Cohost.Formatting; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.Test.Cohost.Formatting; + +[Collection(HtmlFormattingCollection.Name)] +public class HtmlFormattingTest(FormattingTestContext context, HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(context, fixture.Service, testOutput), IClassFixture +{ + [FormattingTestFact] + public async Task FormatsComponentTags() + { + await RunFormattingTestAsync( + input: """ + + @if(true){ +

@DateTime.Now

+ } +
+ + + @foreach (var row in rows){ + + @foreach (var cell in row){ + @cell} + } + + """, + expected: """ + + @if (true) + { +

@DateTime.Now

+ } +
+ + + @foreach (var row in rows) + { + + @foreach (var cell in row) + { + @cell + } + + } + + """); + } + + [FormattingTestFact] + public async Task FormatsComponentTag_WithImplicitExpression() + { + await RunFormattingTestAsync( + input: """ + + + @cell + cell + + + """, + expected: """ + + + @cell + cell + + + """); + } + + [FormattingTestFact] + public async Task FormatsComponentTag_WithExplicitExpression() + { + await RunFormattingTestAsync( + input: """ + + + @(cell) + + + """, + expected: """ + + + @(cell) + + + """); + } + + [FormattingTestFact] + public async Task FormatsComponentTag_WithExplicitExpression_FormatsInside() + { + await RunFormattingTestAsync( + input: """ + + + @("" + "") + + + """, + expected: """ + + + @("" + "") + + + """); + } + + [FormattingTestFact] + public async Task FormatsComponentTag_WithExplicitExpression_MovesStart() + { + await RunFormattingTestAsync( + input: """ + + + + @("" + "") + + + + """, + expected: """ + + + + @("" + "") + + + + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/aspnetcore/issues/30382")] + public async Task FormatNestedComponents2() + { + await RunFormattingTestAsync( + input: """ + + + + + + + + @if (true) + { + + } + + + + + + + + """, + expected: """ + + + + + + + + @if (true) + { + + } + + + + + + + + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor/issues/8227")] + public async Task FormatNestedComponents3() + { + await RunFormattingTestAsync( + input: """ + @if (true) + { + + + + + + + } + + @if (true) + { + + + + + + + } + """, + expected: """ + @if (true) + { + + + + + + + } + + @if (true) + { + + + + + + + } + """); + } + + [FormattingTestFact(Skip = "Requires fix")] + [WorkItem("https://github.com/dotnet/razor/issues/8228")] + public async Task FormatNestedComponents4() + { + await RunFormattingTestAsync( + input: """ + @{ + RenderFragment fragment = + @ + ; + } + """, + expected: """ + @{ + RenderFragment fragment = + @ + ; + } + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor/issues/8229")] + public async Task FormatNestedComponents5() + { + await RunFormattingTestAsync( + input: """ + + @{ + RenderFragment fragment = + @ + ; + } + + """, + expected: """ + + @{ + RenderFragment fragment = + @ + ; + } + + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/aspnetcore/issues/30382")] + public async Task FormatNestedComponents2_Range() + { + await RunFormattingTestAsync( + input: """ + + + + + + + + @if (true) + { + [||] + } + + + + + + + + """, + expected: """ + + + + + + + + @if (true) + { + + } + + + + + + + + """); + } + + [FormattingTestFact] + [WorkItem("https://github.com/dotnet/razor/issues/6211")] + public async Task FormatCascadingValueWithCascadingTypeParameter() + { + await RunFormattingTestAsync( + input: """ + +
+ @foreach ( var i in new int[] { 1, 23 } ) + { +
+ } +
+ + """, + expected: """ + +
+ @foreach (var i in new int[] { 1, 23 }) + { +
+ } +
+ + """); + } + + [FormattingTestFact] + public async Task PreprocessorDirectives() + { + await RunFormattingTestAsync( + input: """ +
+
+ @{ + #if DEBUG + } +
+ @{ + #endif + } +
+ + @code { + private object SomeModel {get;set;} + } + """, + expected: """ +
+
+ @{ + #if DEBUG + } +
+ @{ + #endif + } +
+ + @code { + private object SomeModel { get; set; } + } + """, + allowDiagnostics: true); + } + + private Task RunFormattingTestAsync( + TestCode input, + string expected) + { + return base.RunFormattingTestAsync( + input, + expected, + additionalFiles: [ + (FilePath("Components.cs"), """ + using Microsoft.AspNetCore.Components; + namespace Test + { + public class GridTable : ComponentBase + { + [Parameter] + public RenderFragment ChildContent { get; set; } + } + + public class GridRow : ComponentBase + { + [Parameter] + public RenderFragment ChildContent { get; set; } + } + + public class GridCell : ComponentBase + { + [Parameter] + public RenderFragment ChildContent { get; set; } + } + + public class Component1 : ComponentBase + { + [Parameter] + public string Id { get; set; } + + [Parameter] + public string Caption { get; set; } + + [Parameter] + public RenderFragment Frag {get;set;} + } + } + """), + (FilePath("Select.razor"), """ + @typeparam TValue + @attribute [CascadingTypeParameter(nameof(TValue))] + + + + + @code + { + [Parameter] public TValue SelectedValue { get; set; } + } + """), + (FilePath("SelectItem.razor"), """ + @typeparam TValue + + + @code + { + [Parameter] public TValue Value { get; set; } + [Parameter] public RenderFragment ChildContent { get; set; } + + protected string StringValue => Value?.ToString(); + } + """)]); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RemoteDebugInfoServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RemoteDebugInfoServiceTest.cs index f42e0044009..dd26b38ed2d 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RemoteDebugInfoServiceTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RemoteDebugInfoServiceTest.cs @@ -32,6 +32,16 @@ public async Task ResolveProximityExpressionsAsync_Html() await VerifyProximityExpressionsAsync(input, ["__builder", "this"]); } + [Fact] + public async Task ResolveProximityExpressionsAsync_OnlyHtml() + { + var input = """ + $$
+ """; + + await VerifyProximityExpressionsAsync(input, []); + } + [Fact] public async Task ResolveProximityExpressionsAsync_ExplicitExpression() { @@ -64,6 +74,30 @@ public async Task ResolveProximityExpressionsAsync_OutsideImplicitExpression() await VerifyProximityExpressionsAsync(input, ["__builder", "this"]); } + [Fact] + public async Task ResolveProximityExpressionsAsync_OutsideExplicitStatement() + { + var input = """ +
+ + $$

@{var [|abc|] = 123;}

+ """; + + await VerifyProximityExpressionsAsync(input, ["__builder", "this"]); + } + + [Fact] + public async Task ResolveProximityExpressionsAsync_InsideExplicitStatement() + { + var input = """ +
+ +

@{var$$ [|abc|] = 123;}

+ """; + + await VerifyProximityExpressionsAsync(input, ["__builder", "this"]); + } + [Fact] public async Task ResolveProximityExpressionsAsync_ImplicitExpression() { @@ -174,6 +208,59 @@ public async Task ResolveBreakpointRangeAsync_OutsideImplicitExpression() await VerifyBreakpointRangeAsync(input); } + [Fact] + public async Task ResolveBreakpointRangeAsync_OutsideExplicitStatement() + { + var input = """ +
+ + $$

@{ [|var abc = 123;|] }

+ """; + + await VerifyBreakpointRangeAsync(input); + } + + [Fact] + public async Task ResolveBreakpointRangeAsync_OutsideExplicitStatement_NoCSharpOnLine() + { + var input = """ +
+ + $$

@{ + var abc = 123; + }

+ """; + + await VerifyBreakpointRangeAsync(input); + } + + [Fact] + public async Task ResolveBreakpointRangeAsync_InsideExplicitStatement_NoCSharpOnLine() + { + var input = """ +
+ +

@{ + $$ + var abc = 123; + }

+ """; + + await VerifyBreakpointRangeAsync(input); + } + + [Fact] + public async Task ResolveBreakpointRangeAsync_OutsideExplicitStatement_InvalidLocation() + { + var input = """ +
+ + $$

@{ var abc; }

+ """; + + await VerifyBreakpointRangeAsync(input); + } + [Fact] public async Task ResolveBreakpointRangeAsync_ComponentStartTag() { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions.txt new file mode 100644 index 00000000000..44e48e76d48 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions.txt @@ -0,0 +1,21 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 8 struct name [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property name [static] [Now] +2 0 1 razorTransition [] [@] +0 1 1 razorTransition [] [(] +0 1 7 string [] ["hello"] +0 8 1 operator [] [+] +0 2 1 string [] ["] +0 1 2 string - escape character [] [\\] +0 2 2 string [] [n"] +0 3 1 operator [] [+] +0 2 7 string [] ["world"] +0 8 1 operator [] [+] +0 2 11 class name [static] [Environment] +0 11 1 operator [] [.] +0 1 7 property name [static] [NewLine] +0 8 1 operator [] [+] +0 2 14 string [] ["how are you?"] +0 14 1 razorTransition [] [)] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt new file mode 100644 index 00000000000..44e48e76d48 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt @@ -0,0 +1,21 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 8 struct name [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property name [static] [Now] +2 0 1 razorTransition [] [@] +0 1 1 razorTransition [] [(] +0 1 7 string [] ["hello"] +0 8 1 operator [] [+] +0 2 1 string [] ["] +0 1 2 string - escape character [] [\\] +0 2 2 string [] [n"] +0 3 1 operator [] [+] +0 2 7 string [] ["world"] +0 8 1 operator [] [+] +0 2 11 class name [static] [Environment] +0 11 1 operator [] [.] +0 1 7 property name [static] [NewLine] +0 8 1 operator [] [+] +0 2 14 string [] ["how are you?"] +0 14 1 razorTransition [] [)] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background.txt new file mode 100644 index 00000000000..734b8029813 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [razorCode] [@] +0 1 8 struct name [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property name [static, razorCode] [Now] +2 0 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [(] +0 1 7 string [razorCode] ["hello"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 string [razorCode] ["] +0 1 2 string - escape character [razorCode] [\\] +0 2 2 string [razorCode] [n"] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 7 string [razorCode] ["world"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 11 class name [static, razorCode] [Environment] +0 11 1 operator [razorCode] [.] +0 1 7 property name [static, razorCode] [NewLine] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 14 string [razorCode] ["how are you?"] +0 14 1 razorTransition [razorCode] [)] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt new file mode 100644 index 00000000000..734b8029813 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [razorCode] [@] +0 1 8 struct name [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property name [static, razorCode] [Now] +2 0 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [(] +0 1 7 string [razorCode] ["hello"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 string [razorCode] ["] +0 1 2 string - escape character [razorCode] [\\] +0 2 2 string [razorCode] [n"] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 7 string [razorCode] ["world"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 11 class name [static, razorCode] [Environment] +0 11 1 operator [razorCode] [.] +0 1 7 property name [static, razorCode] [NewLine] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 14 string [razorCode] ["how are you?"] +0 14 1 razorTransition [razorCode] [)] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt new file mode 100644 index 00000000000..1f7a70bd6f5 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt @@ -0,0 +1,26 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 6 keyword [] [static] +0 7 4 keyword [] [bool] +0 5 9 field name [static] [_isStatic] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 keyword - control [] [if] +0 3 1 punctuation [] [(] +0 1 9 field name [static] [_isStatic] +0 9 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt new file mode 100644 index 00000000000..1f7a70bd6f5 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt @@ -0,0 +1,26 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 6 keyword [] [static] +0 7 4 keyword [] [bool] +0 5 9 field name [static] [_isStatic] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 keyword - control [] [if] +0 3 1 punctuation [] [(] +0 1 9 field name [static] [_isStatic] +0 9 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt new file mode 100644 index 00000000000..f5507df10a8 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt @@ -0,0 +1,40 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [static] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [bool] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 9 field name [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 keyword - control [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 9 field name [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt new file mode 100644 index 00000000000..f5507df10a8 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt @@ -0,0 +1,40 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [static] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [bool] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 9 field name [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 keyword - control [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 9 field name [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt new file mode 100644 index 00000000000..e830d034a27 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt @@ -0,0 +1,28 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [] [SampleApp] +0 9 1 operator [] [.] +0 1 5 variable [] [Pages] +0 5 1 operator [] [.] +0 1 10 variable [] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [] [@] +0 1 1 razorTransition [] [{] +1 8 1 razorTransition [] [@] +0 1 5 property name [] [Model] +0 5 1 operator [] [.] +0 1 8 variable [] [ToString] +0 8 1 punctuation [] [(] +0 1 1 punctuation [] [)] +0 1 1 punctuation [] [;] +1 4 1 razorTransition [] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt new file mode 100644 index 00000000000..68fbef584f4 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt @@ -0,0 +1,28 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [] [SampleApp] +0 9 1 operator [] [.] +0 1 5 variable [] [Pages] +0 5 1 operator [] [.] +0 1 10 variable [] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [] [@] +0 1 1 razorTransition [] [{] +1 8 1 razorTransition [] [@] +0 1 5 variable [] [Model] +0 5 1 operator [] [.] +0 1 8 variable [] [ToString] +0 8 1 punctuation [] [(] +0 1 1 punctuation [] [)] +0 1 1 punctuation [] [;] +1 4 1 razorTransition [] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt new file mode 100644 index 00000000000..b4ce0bcab7c --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [razorCode] [SampleApp] +0 9 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Pages] +0 5 1 operator [razorCode] [.] +0 1 10 variable [razorCode] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [{] +1 8 1 razorTransition [razorCode] [@] +0 1 5 property name [razorCode] [Model] +0 5 1 operator [razorCode] [.] +0 1 8 variable [razorCode] [ToString] +0 8 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] [;] +1 4 1 razorTransition [razorCode] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt new file mode 100644 index 00000000000..2a53fba49c4 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [razorCode] [SampleApp] +0 9 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Pages] +0 5 1 operator [razorCode] [.] +0 1 10 variable [razorCode] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [{] +1 8 1 razorTransition [razorCode] [@] +0 1 5 variable [razorCode] [Model] +0 5 1 operator [razorCode] [.] +0 1 8 variable [razorCode] [ToString] +0 8 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] [;] +1 4 1 razorTransition [razorCode] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt new file mode 100644 index 00000000000..84c1364073b --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 4 keyword [] [void] +0 5 14 method name [] [BidsByShipment] +0 14 1 punctuation [] [(] +0 1 6 keyword [] [string] +0 7 11 parameter name [] [generatedId] +0 11 1 punctuation [] [,] +0 2 3 keyword [] [int] +0 4 4 parameter name [] [bids] +0 4 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 keyword - control [] [if] +0 3 1 punctuation [] [(] +0 1 4 parameter name [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [] [@] +0 1 2 keyword - control [] [if] +0 2 1 punctuation [] [(] +0 1 4 parameter name [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 16 1 punctuation [] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [] [@] +0 1 8 struct name [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property name [static] [Now] +0 3 7 razorDirective [] [] +1 16 1 punctuation [] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt new file mode 100644 index 00000000000..84c1364073b --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 4 keyword [] [void] +0 5 14 method name [] [BidsByShipment] +0 14 1 punctuation [] [(] +0 1 6 keyword [] [string] +0 7 11 parameter name [] [generatedId] +0 11 1 punctuation [] [,] +0 2 3 keyword [] [int] +0 4 4 parameter name [] [bids] +0 4 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 keyword - control [] [if] +0 3 1 punctuation [] [(] +0 1 4 parameter name [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [] [@] +0 1 2 keyword - control [] [if] +0 2 1 punctuation [] [(] +0 1 4 parameter name [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 16 1 punctuation [] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [] [@] +0 1 8 struct name [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property name [static] [Now] +0 3 7 razorDirective [] [] +1 16 1 punctuation [] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt new file mode 100644 index 00000000000..6781b901eef --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt @@ -0,0 +1,74 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 14 method name [razorCode] [BidsByShipment] +0 14 1 punctuation [razorCode] [(] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 11 parameter name [razorCode] [generatedId] +0 11 1 punctuation [razorCode] [,] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 keyword [razorCode] [int] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 4 parameter name [razorCode] [bids] +0 4 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 keyword - control [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 parameter name [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [razorCode] [@] +0 1 2 keyword - control [razorCode] [if] +0 2 1 punctuation [razorCode] [(] +0 1 4 parameter name [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [razorCode] [@] +0 1 8 struct name [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property name [static, razorCode] [Now] +0 3 7 razorDirective [] [] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt new file mode 100644 index 00000000000..6781b901eef --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt @@ -0,0 +1,74 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 14 method name [razorCode] [BidsByShipment] +0 14 1 punctuation [razorCode] [(] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 11 parameter name [razorCode] [generatedId] +0 11 1 punctuation [razorCode] [,] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 keyword [razorCode] [int] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 4 parameter name [razorCode] [bids] +0 4 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 keyword - control [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 parameter name [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [razorCode] [@] +0 1 2 keyword - control [razorCode] [if] +0 2 1 punctuation [razorCode] [(] +0 1 4 parameter name [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [razorCode] [@] +0 1 8 struct name [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property name [static, razorCode] [Now] +0 3 7 razorDirective [] [] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt new file mode 100644 index 00000000000..cfe7cc8f772 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt @@ -0,0 +1,23 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 4 6 delegate name [] [Action] +0 6 1 punctuation [] [<] +0 1 6 keyword [] [object] +0 6 1 punctuation [] [>] +0 2 3 field name [] [abc] +0 4 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt new file mode 100644 index 00000000000..cfe7cc8f772 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt @@ -0,0 +1,23 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace name [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 4 6 delegate name [] [Action] +0 6 1 punctuation [] [<] +0 1 6 keyword [] [object] +0 6 1 punctuation [] [>] +0 2 3 field name [] [abc] +0 4 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt new file mode 100644 index 00000000000..2dae57f4cd5 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt @@ -0,0 +1,27 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 delegate name [razorCode] [Action] +0 6 1 punctuation [razorCode] [<] +0 1 6 keyword [razorCode] [object] +0 6 1 punctuation [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 field name [razorCode] [abc] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt new file mode 100644 index 00000000000..2dae57f4cd5 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt @@ -0,0 +1,27 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace name [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 delegate name [razorCode] [Action] +0 6 1 punctuation [razorCode] [<] +0 1 6 keyword [razorCode] [object] +0 6 1 punctuation [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 field name [razorCode] [abc] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment.txt new file mode 100644 index 00000000000..50146b23214 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment.txt @@ -0,0 +1,31 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 delegate name [] [RenderFragment] +0 15 1 local name [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt new file mode 100644 index 00000000000..a3a666fa8d5 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt @@ -0,0 +1,31 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method name [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 variable [] [RenderFragment] +0 15 1 local name [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt new file mode 100644 index 00000000000..298d387b661 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 delegate name [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 local name [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt new file mode 100644 index 00000000000..f96090f9e4f --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method name [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 variable [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 local name [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/AddUsingTests.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/AddUsingTests.cs index d371a075978..7f12a5f9266 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/AddUsingTests.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/AddUsingTests.cs @@ -61,8 +61,96 @@ public class StringBuilder codeActionName: LanguageServerConstants.CodeActions.FullyQualify, childActionIndex: 0); } + + // This uses a nested code action in Roslyn which we don't support in VS Code + // https://github.com/dotnet/razor/issues/11832 + [Fact] + public async Task FullyQualify_Multiple2() + { + await VerifyCodeActionAsync( + input: """ + @code + { + private [||]StringBuilder _x = new StringBuilder(); + } + """, + expected: """ + @code + { + private Not.Built.In.StringBuilder _x = new StringBuilder(); + } + """, + additionalFiles: [ + (FilePath("StringBuilder.cs"), """ + namespace Not.Built.In; + + public class StringBuilder + { + } + """)], + codeActionName: LanguageServerConstants.CodeActions.FullyQualify, + childActionIndex: 1); + } #endif + [Fact] + public async Task AddUsing_Multiple() + { + await VerifyCodeActionAsync( + input: """ + @code + { + private [||]StringBuilder _x = new StringBuilder(); + } + """, + expected: """ + @using Not.Built.In + @code + { + private StringBuilder _x = new StringBuilder(); + } + """, + additionalFiles: [ + (FilePath("StringBuilder.cs"), """ + namespace Not.Built.In; + + public class StringBuilder + { + } + """)], + codeActionName: RazorPredefinedCodeFixProviderNames.AddImport, + codeActionIndex: 0); + } + + [Fact] + public async Task AddUsing_Multiple2() + { + await VerifyCodeActionAsync( + input: """ + @code + { + private [||]StringBuilder _x = new StringBuilder(); + } + """, + expected: """ + @using System.Text + @code + { + private StringBuilder _x = new StringBuilder(); + } + """, + additionalFiles: [ + (FilePath("StringBuilder.cs"), """ + namespace Not.Built.In; + + public class StringBuilder + { + } + """)], + codeActionName: RazorPredefinedCodeFixProviderNames.AddImport, + codeActionIndex: 1); + } + [Fact] public async Task AddUsing() { diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CohostCodeActionsEndpointTestBase.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CohostCodeActionsEndpointTestBase.cs index 643d48b74ed..379550ebb51 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CohostCodeActionsEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CohostCodeActionsEndpointTestBase.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Text; using System.Text.Json; using System.Text.Json.Nodes; using System.Threading.Tasks; @@ -19,7 +17,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.CodeActions; using Microsoft.CodeAnalysis.Razor.Telemetry; -using Microsoft.CodeAnalysis.Razor.Utilities; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Remote.Razor; using Roslyn.Test.Utilities; @@ -34,6 +31,7 @@ private protected async Task VerifyCodeActionAsync( TestCode input, string? expected, string codeActionName, + int? codeActionIndex = null, int childActionIndex = 0, RazorFileKind? fileKind = null, string? documentFilePath = null, @@ -43,7 +41,7 @@ private protected async Task VerifyCodeActionAsync( { var document = CreateRazorDocument(input, fileKind, documentFilePath, additionalFiles, addDefaultImports: addDefaultImports); - var codeAction = await VerifyCodeActionRequestAsync(document, input, codeActionName, childActionIndex, expectOffer: expected is not null); + var codeAction = await VerifyCodeActionRequestAsync(document, input, codeActionName, codeActionIndex, childActionIndex, expectOffer: expected is not null); if (codeAction is null) { @@ -82,7 +80,7 @@ private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind return CreateProjectAndRazorDocument(input.Text, fileKind, documentFilePath, additionalFiles: additionalFiles, addDefaultImports: addDefaultImports); } - private async Task VerifyCodeActionRequestAsync(TextDocument document, TestCode input, string codeActionName, int childActionIndex, bool expectOffer) + private async Task VerifyCodeActionRequestAsync(TextDocument document, TestCode input, string codeActionName, int? codeActionIndex, int childActionIndex, bool expectOffer) { var result = await GetCodeActionsAsync(document, input); if (result is null) @@ -90,7 +88,18 @@ private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind return null; } - var codeActionToRun = (VSInternalCodeAction?)result.SingleOrDefault(e => ((RazorVSInternalCodeAction)e.Value!).Name == codeActionName).Value; + var codeActions = result.Where(e => ((RazorVSInternalCodeAction)e.Value!).Name == codeActionName).ToArray(); + + if (codeActions.Length > 1 && !codeActionIndex.HasValue) + { + Assert.Fail($"Multiple code actions with name '{codeActionName}' were found. Specify a codeActionIndex to disambiguate."); + return null; + } + + var index = codeActionIndex ?? 0; + var codeActionToRun = codeActions.Length > index + ? (VSInternalCodeAction?)codeActions[index] + : null; if (!expectOffer) { @@ -99,7 +108,7 @@ private protected TextDocument CreateRazorDocument(TestCode input, RazorFileKind } AssertEx.NotNull(codeActionToRun, $""" - Could not find code action with name '{codeActionName}'. + Could not find {(codeActionIndex is null ? "single" : $"index {codeActionIndex}")} code action with name '{codeActionName}'. Available: {string.Join(Environment.NewLine + " ", result.Select(e => ((RazorVSInternalCodeAction)e.Value!).Name))} diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CreateComponentFromTagTests.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CreateComponentFromTagTests.cs index c2e93882ed6..91921fef86f 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CreateComponentFromTagTests.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/CreateComponentFromTagTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.Protocol; using Xunit; using Xunit.Abstractions; @@ -10,6 +11,20 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost.CodeActions; public class CreateComponentFromTagTests(ITestOutputHelper testOutputHelper) : CohostCodeActionsEndpointTestBase(testOutputHelper) { + [Fact] + public async Task NotOfferedInLegacy() + { + await VerifyCodeActionAsync( + input: """ +
+ + + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.CreateComponentFromTag, + fileKind: RazorFileKind.Legacy); + } + [Fact] public async Task CreateComponentFromTag() { @@ -29,6 +44,32 @@ await VerifyCodeActionAsync( (FileUri("Hello.razor"), "")]); } + [Fact] + public async Task CreateComponentFromTag_WithNamespace() + { + await VerifyCodeActionAsync( + input: """ + @namespace MyApp.Components + +
+ + + """, + expected: """ + @namespace MyApp.Components + +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.CreateComponentFromTag, + additionalExpectedFiles: [ + (FileUri("Hello.razor"), """ + @namespace MyApp.Components + + """)]); + } + [Fact] public async Task Attribute() { diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToCodeBehindTests.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToCodeBehindTests.cs index 4cc54d5eb2c..c27c4303f6a 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToCodeBehindTests.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToCodeBehindTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.Protocol; using Xunit; using Xunit.Abstractions; @@ -10,6 +11,102 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost.CodeActions; public class ExtractToCodeBehindTests(ITestOutputHelper testOutputHelper) : CohostCodeActionsEndpointTestBase(testOutputHelper) { + [Fact] + public async Task NotOfferedInLegacy() + { + await VerifyCodeActionAsync( + input: """ + @co[||]de + { + private int x = 1; + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind, + fileKind: RazorFileKind.Legacy); + } + + [Fact] + public async Task OutsideCodeDirective() + { + await VerifyCodeActionAsync( + input: """ +
+ + @code + { + private int x = 1; + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind); + } + + [Fact] + public async Task NotInEmptyCodeBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + @code {$$} + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind); + } + + [Fact] + public async Task NotInEmptyMalformedCodeBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + @$$code + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind); + } + + [Fact] + public async Task NotWithMarkup() + { + await VerifyCodeActionAsync( + input: """ +
+ @$$code { + void Test() + { +

Hello, world!

+ } + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind); + } + + [Fact] + public async Task NotWithoutFileCreation() + { + UpdateClientInitializationOptions(c => + { + c.SupportsFileManipulation = false; + return c; + }); + + await VerifyCodeActionAsync( + input: """ +
+ @$$code { + void Test() + { + } + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind); + } + [Fact] public async Task ExtractToCodeBehind() { @@ -47,6 +144,12 @@ public partial class File1 [InlineData("@co[||]de {")] [InlineData("@cod[||]e {")] [InlineData("@code[||] {")] + [InlineData("[||]@code\n{")] + [InlineData("@[||]code\n{")] + [InlineData("@c[||]ode\n{")] + [InlineData("@co[||]de\n{")] + [InlineData("@cod[||]e\n{")] + [InlineData("@code[||]\n{")] [InlineData("@code[||]{")] public async Task WorkAtAnyCursorPosition(string codeBlockStart) { @@ -75,4 +178,50 @@ public partial class File1 } """)]); } + + [Fact] + public async Task ExtractToCodeBehind_WithUsing() + { + await VerifyCodeActionAsync( + input: """ + @using System.Diagnostics + +
+ + @co[||]de + { + private int x = 1; + + private void M() + { + Debug.WriteLine(""); + } + } + """, + expected: """ + @using System.Diagnostics + +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind, + additionalExpectedFiles: [ + (FileUri("File1.razor.cs"), $$""" + using System.Diagnostics; + + namespace SomeProject + { + public partial class File1 + { + private int x = 1; + + private void M() + { + Debug.WriteLine(""); + } + } + } + """)]); + } } diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToComponentTests.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToComponentTests.cs index 6d3cb25c3d9..fed2993b16c 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToComponentTests.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/ExtractToComponentTests.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.Razor.Protocol; using Xunit; using Xunit.Abstractions; @@ -10,6 +12,21 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost.CodeActions; public class ExtractToComponentTests(ITestOutputHelper testOutputHelper) : CohostCodeActionsEndpointTestBase(testOutputHelper) { + [Fact] + public async Task NotOfferedInLegacy() + { + await VerifyCodeActionAsync( + input: """ + @co[||]de + { + private int x = 1; + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToCodeBehind, + fileKind: RazorFileKind.Legacy); + } + [Fact] public async Task ExtractToComponent() { @@ -39,6 +56,71 @@ Hello World """)]); } + [Fact] + public async Task ExtractToComponent_SinglePointSelection() + { + await VerifyCodeActionAsync( + input: """ +
+ + $$
+ Hello World +
+ +
+ """, + expected: """ +
+ + + +
+ """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ """)]); + } + + [Fact] + public async Task DontOfferOnSinglePointSelectionInElement() + { + await VerifyCodeActionAsync( + input: """ +
+ +
+ Hello $$World +
+ +
+ """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent); + } + + [Fact] + public async Task DontOfferInCodeBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + @code + { + [|public int I { get; set; } + public void M() + { + }|] + } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent); + } + [Fact] public async Task DontOfferOnNonExistentComponent() { @@ -131,4 +213,796 @@ Hello World
""")]); } + + [Fact] + public async Task SelectionEndAfterElement() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ [|
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
|] +
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
+ """)]); + } + + [Fact] + public async Task SelectionEndInsideSiblingElement1() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ [|
+

Div a title

+

Div a par

+
+
+

Div b title

|] +

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
+ """)]); + } + + [Fact] + public async Task SelectionEndInsideSiblingElement2() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ [|
+

Div a title

+

Div a par

+
+
+

Div b title|]

+

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
+ """)]); + } + + [Fact] + public async Task SelectionStartInsideSiblingElement() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+
+

[|Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
|] +
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
+ """)]); + } + + [Fact] + public async Task SelectionStartAndEndInsideSiblingElement() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+
+

[|Div a title

+

Div a par

+
+
+

Div b title

+

Div b par|]

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+
+

Div b title

+

Div b par

+
+ """)]); + } + + [Fact] + public async Task SelectionEndInsideElement() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ [|
+

Div a title

+

Div a par

|] +
+
+

Div b title

+

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+

Div b title

+

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + +
+

Div a title

+

Div a par

+
+ """)]); + } + + [Fact] + public async Task SelectionStartWithSelfClosing() + { + await VerifyCodeActionAsync( + input: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ [| +
+

Div a title

+

Div a par

+
|] +
+

Div b title

+

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + expected: """ + @namespace MarketApp.Pages.Product.Home + + Home + +
+ +
+

Div b title

+

Div b par

+
+
+ +

Hello, world!

+ + Welcome to your new app. + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @namespace MarketApp.Pages.Product.Home + + +
+

Div a title

+

Div a par

+
+ """)]); + } + + [Fact] + public async Task IncludeCodeBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|
+ Hello World +
+ + @code { + |] + } + """, + expected: """ +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ + @code { + + } + """)]); + } + + [Fact] + public async Task IncludeIfBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|
+ Hello World +
+ + @if (true) + { + |] + } + """, + expected: """ +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ + @if (true) + { + + } + """)]); + } + + [Fact] + public async Task IncludeNestedIfBlock() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|
+ Hello World +
+ +
+
+ @if (true) { + |] + } +
+
+ """, + expected: """ +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ +
+
+ @if (true) { + + } +
+
+ """)]); + } + + [Fact] + public async Task ExplicitStatement() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|
+ Hello World +
+ + @{ + RenderFragment fragment = @|] ; + } + """, + expected: """ +
+ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ + @{ + RenderFragment fragment = @ ; + } + """)]); + } + + [Fact] + public async Task SingleLineElement() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|
Hello World
|] + +
+ """, + expected: """ +
+ + + +
+ """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
Hello World
+ """)]); + } + + [Fact] + public async Task TextOnly() + { + await VerifyCodeActionAsync( + input: """ +
+ + [|Hello World|] + +
+ """, + expected: """ +
+ + + +
+ """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + Hello World + """)]); + } + + [Fact] + public async Task PartialTextOnly() + { + await VerifyCodeActionAsync( + input: """ +
+ + Hello [|World|] + +
+ """, + expected: """ +
+ + Hello + +
+ """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + World + """)]); + } + + [Fact] + public async Task SelectionStartInText() + { + await VerifyCodeActionAsync( + input: """ +
+ + Hello [|World + +
+ Hello|] World +
+ """, + expected: """ +
+ + Hello + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + World + +
+ Hello World +
+ """)]); + } + + [Fact] + public async Task SelectionEndInText() + { + await VerifyCodeActionAsync( + input: """ +
+ +
+ Hello [|World +
+ + Hello |]World + """, + expected: """ +
+ + World + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ + Hello + """)]); + } + + [Fact] + [WorkItem("https://github.com/dotnet/razor/issues/11261")] + public async Task InsideElseBlock1() + { + await VerifyCodeActionAsync( + input: """ +
+ + @if (true) + { +
+ Hello World +
+ } + else + { + [|
+ Hello World +
|] + } + """, + expected: """ +
+ + @if (true) + { +
+ Hello World +
+ } + else + { + + } + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+ Hello World +
+ """)]); + } + + [Fact] + [WorkItem("https://github.com/dotnet/razor/issues/11261")] + public async Task InsideElseBlock2() + { + await VerifyCodeActionAsync( + input: """ +
+ + @if (true) + { +
+ Hello World +
+ } + else + { + $$
+ Hello World +
+ } + """, + expected: null, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent); + } + + [Fact] + public async Task ExtractToComponent_WithUsings() + { + await VerifyCodeActionAsync( + input: """ + @using MyApp.Data + @using MyApp.Models + + <[|div id="parent"> +
+
+
+

Deeply nested par +

+
+
+
+ """, + expected: """ + @using MyApp.Data + @using MyApp.Models + + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ + @using MyApp.Data + @using MyApp.Models + +
+
+
+
+

Deeply nested par

+
+
+
+
+ """)]); + } + + [Fact] + public async Task SelectStartWithinElement() + { + await VerifyCodeActionAsync( + input: """ + <[|div id="parent"> +
+
+
+

Deeply nested par +

+
+
+
+ """, + expected: """ + + """, + codeActionName: LanguageServerConstants.CodeActions.ExtractToNewComponent, + additionalExpectedFiles: [ + (FileUri("Component.razor"), """ +
+
+
+
+

Deeply nested par

+
+
+
+
+ """)]); + } } diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/GenerateEventHandlerTests.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/GenerateEventHandlerTests.cs index 61cd467979a..174b88248c3 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/GenerateEventHandlerTests.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CodeActions/GenerateEventHandlerTests.cs @@ -56,6 +56,38 @@ private void DoesNotExist(MouseEventArgs args) await VerifyCodeActionAsync(input, expected, LanguageServerConstants.CodeActions.GenerateEventHandler); } + [Fact] + public async Task CodeBlock_WithExistingCode() + { + var input = """ + + + @code + { + public void M() + { + } + } + """; + + var expected = """ + + + @code + { + public void M() + { + } + private void DoesNotExist(MouseEventArgs args) + { + throw new NotImplementedException(); + } + } + """; + + await VerifyCodeActionAsync(input, expected, LanguageServerConstants.CodeActions.GenerateEventHandler); + } + [Fact] public async Task CodeBlock_Indented() { @@ -80,7 +112,7 @@ private void DoesNotExist(MouseEventArgs args) await VerifyCodeActionAsync(input, expected, LanguageServerConstants.CodeActions.GenerateEventHandler); } - [Fact(Skip = "@bind- attribute tag helper is not being found")] + [Fact(Skip = "https://github.com/dotnet/razor/issues/11801")] public async Task BindSet() { var input = """ @@ -108,7 +140,7 @@ private void DoesNotExist(string args) await VerifyCodeActionAsync(input, expected, LanguageServerConstants.CodeActions.GenerateEventHandler); } - [Fact(Skip = "@bind- attribute tag helper is not being found")] + [Fact(Skip = "https://github.com/dotnet/razor/issues/11801")] public async Task BindAfter() { var input = """ @@ -255,6 +287,47 @@ private void DoesNotExist(Microsoft.AspNetCore.Components.Web.MouseEventArgs arg codeActionName: LanguageServerConstants.CodeActions.GenerateEventHandler); } + [Fact] + public async Task CodeBehind_BlockBodiedNamespace() + { + await VerifyCodeActionAsync( + input: """ + + """, + expected: """ + + """, + additionalFiles: [ + (FilePath("File1.razor.cs"), """ + namespace SomeProject + { + public partial class File1 + { + public void M() + { + } + } + } + """)], + additionalExpectedFiles: [ + (FileUri("File1.razor.cs"), """ + namespace SomeProject + { + public partial class File1 + { + public void M() + { + } + private void DoesNotExist(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + { + throw new System.NotImplementedException(); + } + } + } + """)], + codeActionName: LanguageServerConstants.CodeActions.GenerateEventHandler); + } + [Fact] public async Task EmptyCodeBehind() { @@ -333,4 +406,18 @@ private Task DoesNotExist(MouseEventArgs args) await VerifyCodeActionAsync(input, expected, LanguageServerConstants.CodeActions.GenerateAsyncEventHandler); } + + [Fact] + public async Task NotInRefAttribute() + { + var input = """ + + + @code + { + } + """; + + await VerifyCodeActionAsync(input, expected: null, LanguageServerConstants.CodeActions.GenerateAsyncEventHandler); + } } diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostDocumentCompletionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostDocumentCompletionEndpointTest.cs index 09ac5ce7446..50996fb595f 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostDocumentCompletionEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostDocumentCompletionEndpointTest.cs @@ -1,8 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using System.Text; using System.Text.Json; @@ -18,11 +20,11 @@ using Microsoft.CodeAnalysis.Razor.Settings; using Microsoft.CodeAnalysis.Razor.Telemetry; using Microsoft.CodeAnalysis.Razor.Workspaces.Resources; +using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Roslyn.Text.Adornments; using Xunit; using Xunit.Abstractions; -using Microsoft.CodeAnalysis.Text; using WorkItemAttribute = Roslyn.Test.Utilities.WorkItemAttribute; #if !VSCODE @@ -34,6 +36,29 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; public partial class CohostDocumentCompletionEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) { + [Fact] + public async Task NotWhenAutoShowCompletionIsOff() + { + var settings = ClientSettingsManager.GetClientSettings(); + ClientSettingsManager.Update(settings.ClientCompletionSettings with { AutoShowCompletion = false }); + + await VerifyCompletionListAsync( + input: """ + This is a Razor document. + + @$$ + + The end. + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Typing, + TriggerCharacter = "@", + TriggerKind = CompletionTriggerKind.TriggerCharacter + }, + expectedItemLabels: null); + } + [Fact] public async Task CSharpInEmptyExplicitStatement() { @@ -707,6 +732,33 @@ The end. #endif } + [Fact] + public async Task HtmlAttributeNamesAndTagHelpersCompletion_SelfClosing() + { + await VerifyCompletionListAsync( + input: """ + This is a Razor document. + + + + The end. + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Explicit, + TriggerCharacter = null, + TriggerKind = CompletionTriggerKind.Invoked + }, + expectedItemLabels: ["style", "dir", "FormName", "OnValidSubmit", "@..."], + htmlItemLabels: ["style", "dir"], + itemToResolve: "FormName", +#if VSCODE + expectedResolvedItemDescription: "string EditForm.FormName"); +#else + expectedResolvedItemDescription: "string Microsoft.AspNetCore.Components.Forms.EditForm.FormName"); +#endif + } + [Fact] public async Task HtmlAttributeNamesAndTagHelpersCompletion_EndOfDocument() { @@ -769,8 +821,45 @@ The end. htmlItemLabels: ["style"], autoInsertAttributeQuotes: false); + Assert.NotNull(list); Assert.All(list.Items, item => Assert.DoesNotContain("=", item.CommitCharacters ?? [])); } + + [Fact] + public async Task CSharp_WithUsing() + { + // Roslyn won't send unimported types if SupportsVisualStudioExtensions is true + + await VerifyCompletionListAsync( + input: """ + @{ + void Foo() + { + String$$ + } + } + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Explicit, + TriggerCharacter = null, + TriggerKind = CompletionTriggerKind.Invoked + }, + expectedItemLabels: ["char", "DateTime", "StringBuilder"], + itemToResolve: "StringBuilder", + expectedResolvedItemDescription: "class System.Text.StringBuilder", + expected: """ + @using System.Text + @{ + void Foo() + { + StringBuilder + } + } + """, + // Completion from unimported types is computed in the background + retryTimeout: TimeSpan.FromSeconds(5)); + } #endif [Fact] @@ -914,10 +1003,149 @@ The end. expectedItemLabels: [.. CSharpRazorKeywordCompletionItemProvider.CSharpRazorKeywords]); } - private async Task VerifyCompletionListAsync( + [Fact] + public async Task CSharp_AwaitKeyword() + { + await VerifyCompletionListAsync( + input: """ + @{ + Task FooAsync() + { + awai$$ + } + } + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Explicit, + TriggerCharacter = null, + TriggerKind = CompletionTriggerKind.Invoked + }, + expectedItemLabels: ["char", "DateTime", "await"], + itemToResolve: "await", + expectedResolvedItemDescription: "await Keyword\r\nAsynchronously waits for the task to finish.", + expected: """ + @{ + async Task FooAsync() + { + await + } + } + """); + } + + [Fact] + public async Task RazorHelpersFilteredOut() + { + await VerifyCompletionListAsync( + input: """ + This is a Razor document. + + @{ var __helper = 3; } + + @$$ + + The end. + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Explicit, + TriggerCharacter = null, + TriggerKind = CompletionTriggerKind.Invoked, + }, + expectedItemLabels: ["char", "DateTime", "Exception"], + unexpectedItemLabels: ["__builder", "__helper"]); + } + + [Fact] + public async Task RazorHelpersNotFilteredIfTyping() + { + await VerifyCompletionListAsync( + input: """ + This is a Razor document. + + @{ var __helper = 3; } + + @__$$ + + The end. + """, + completionContext: new VSInternalCompletionContext() + { + InvokeKind = VSInternalCompletionInvokeKind.Explicit, + TriggerCharacter = null, + TriggerKind = CompletionTriggerKind.Invoked, + }, + expectedItemLabels: ["char", "DateTime", "Exception", "__helper"], + unexpectedItemLabels: ["__builder"]); + } + + [Fact] + public async Task IndexerAttributes1() + { + await VerifyCompletionListAsync( + input: """ + This is a Razor document. + + Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.RouteValues", +#endif + fileKind: RazorFileKind.Legacy); + } + + private async Task VerifyCompletionListAsync( TestCode input, VSInternalCompletionContext completionContext, - string[] expectedItemLabels, + string[]? expectedItemLabels, string[]? unexpectedItemLabels = null, string[]? htmlItemLabels = null, string[]? htmlItemCommitCharacters = null, @@ -927,7 +1155,8 @@ private async Task VerifyCompletionListAsync( string? expectedResolvedItemDescription = null, bool autoInsertAttributeQuotes = true, bool commitElementsWithSpace = true, - RazorFileKind? fileKind = null) + RazorFileKind? fileKind = null, + TimeSpan? retryTimeout = null) { var document = CreateProjectAndRazorDocument(input.Text, fileKind); var sourceText = await document.GetTextAsync(DisposalToken); @@ -987,7 +1216,28 @@ private async Task VerifyCompletionListAsync( var result = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); - Assert.NotNull(result); + if (result is null) + { + Assert.Null(expectedItemLabels); + return null; + } + + Assert.NotNull(expectedItemLabels); + + if (retryTimeout is not null && itemToResolve is not null) + { + var sw = Stopwatch.StartNew(); + while (result.Items.FirstOrDefault(i => i.Label == itemToResolve) == null) + { + Assert.True(sw.Elapsed < TimeSpan.FromSeconds(5), "Failed to resolve unimported completion item after 5 second."); + + // Roslyn only computes unimported types in the background, and we have no access to its internal workings to wait for it to be + // finished, so we just have to delay and ask for completion items again. + await Task.Delay(100, DisposalToken); + result = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + Assert.NotNull(result); + } + } using var _ = HashSetPool.GetPooledObject(out var labelSet); labelSet.AddRange(result.Items.SelectAsArray((item) => item.Label)); @@ -1132,7 +1382,18 @@ private async Task VerifyCompletionResolveAsync(CodeAnalysis.TextDocument docume var text = await document.GetTextAsync(DisposalToken).ConfigureAwait(false); var insertIndex = text.GetRequiredAbsoluteIndex(position); - changedText = text.WithChanges(new TextChange(new TextSpan(insertIndex, 0), label)); + var startIndex = insertIndex; + // If there is already a word in the document, replace it + for (var i = insertIndex - 1; i > 0; i--) + { + if (!char.IsLetter(text[i])) + { + startIndex = i + 1; + break; + } + } + + changedText = text.WithChanges(new TextChange(TextSpan.FromBounds(startIndex, insertIndex), label)); } else if (expected is not null) { diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostOnAutoInsertEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostOnAutoInsertEndpointTest.cs index f43ec8c6db7..938a9c57d53 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostOnAutoInsertEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostOnAutoInsertEndpointTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor.AutoInsert; @@ -41,6 +42,295 @@ The end. triggerCharacter: ">"); } + [Theory] + [InlineData("PageTitle")] + [InlineData("div")] + [InlineData("text")] + public async Task EndTag_InCSharp(string startTag) + { + await VerifyOnAutoInsertAsync( + input: $$""" +
+ @if (true) + { + <{{startTag}}>$$ + } +
+ """, + output: $$""" +
+ @if (true) + { + <{{startTag}}>$0 + } +
+ """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_AlreadyExists() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: null, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_TagStructure_WithoutEndTag() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">", + fileKind: RazorFileKind.Legacy); + } + + [Fact] + public async Task EndTag_TagStructure_WithoutEndTag_AlreadyExists() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">", + fileKind: RazorFileKind.Legacy); + } + + [Fact] + public async Task EndTag_CloseOutOfScope() + { + await VerifyOnAutoInsertAsync( + input: """ +
+ @if (true) + { +
$$
+ } + """, + output: """ +
+ @if (true) + { +
$0
+ } + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_VoidElement() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_VoidElement_CaseInsensitive() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + +
$$
+ + The end. + """, + output: """ + This is a Razor document. + +
$0
+ + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested_WithAttribute() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + +
+ + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested_WithAttribute_WithSpace() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested_WithMinimizedAttribute() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + +
$$
+ + The end. + """, + output: """ + This is a Razor document. + +
$0
+ + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested_WithMinimizedAttribute_WithSpace() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + +
$$
+ + The end. + """, + output: """ + This is a Razor document. + +
$0
+ + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_Nested_VoidElement() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: """ + This is a Razor document. + + + + The end. + """, + triggerCharacter: ">"); + } + + [Fact] + public async Task EndTag_VoidElement_AlreadyClosed() + { + await VerifyOnAutoInsertAsync( + input: """ + This is a Razor document. + + $$ + + The end. + """, + output: null, + triggerCharacter: ">"); + } + [Theory] [InlineData("PageTitle")] [InlineData("div")] @@ -124,6 +414,31 @@ void TestMethod() {} triggerCharacter: "/"); } + [Fact] + public async Task CSharp_DocComment_OnEnter() + { + await VerifyOnAutoInsertAsync( + input: """ + @code { + /// + /// This is some text + $$ + /// + void TestMethod() {} + } + """, + output: """ + @code { + /// + /// This is some text + /// $0 + /// + void TestMethod() {} + } + """, + triggerCharacter: "\n"); + } + [Fact] public async Task DoNotAutoInsertCSharp_OnForwardSlashWithFormatOnTypeDisabled() { @@ -231,9 +546,11 @@ private async Task VerifyOnAutoInsertAsync( bool insertSpaces = true, int tabSize = 4, bool formatOnType = true, - bool autoClosingTags = true) + bool autoClosingTags = true, + RazorFileKind? fileKind = null) { - var document = CreateProjectAndRazorDocument(input.Text); + fileKind ??= RazorFileKind.Component; + var document = CreateProjectAndRazorDocument(input.Text, fileKind: fileKind); var sourceText = await document.GetTextAsync(DisposalToken); ClientSettingsManager.Update(ClientAdvancedSettings.Default with { FormatOnType = formatOnType, AutoClosingTags = autoClosingTags }); diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostSemanticTokensRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostSemanticTokensRangeEndpointTest.cs index 90bdc8130a1..b17fe22f4db 100644 --- a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostSemanticTokensRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostSemanticTokensRangeEndpointTest.cs @@ -196,6 +196,181 @@ @rendermode @(Microsoft.AspNetCore.Components.Web.RenderMode.InteractiveServer) await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); } + [Theory] + [CombinatorialData] + public async Task RenderFragment(bool colorBackground, bool miscellaneousFile) + { + var input = """ +
This is some HTML
+ @code + { + public void M() + { + RenderFragment x = @
This is some HTML
; + } + } + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task Expressions(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @DateTime.Now + + @("hello" + "\\n" + "world" + Environment.NewLine + "how are you?") + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_NestedTextDirectives(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @using System + @functions { + private void BidsByShipment(string generatedId, int bids) + { + if (bids > 0) + { + + @if(bids > 0) + { + @DateTime.Now + } + + } + } + } + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_NestedTransitions(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @using System + @code { + Action abc = @; + } + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_CommentAsync(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @* A comment *@ + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_MultiLineCommentMidlineAsync(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @* kdl + skd + slf*@ + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_MultiLineCommentWithBlankLines(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @* kdl + + skd + + sdfasdfasdf + slf*@ + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + [WorkItem("https://github.com/dotnet/razor/issues/8176")] + public async Task GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF(bool colorBackground, bool miscellaneousFile) + { + var input = "@* kdl\n\nskd\n \n sdfasdfasdf\nslf*@"; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Razor_MultiLineCommentAsync(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @*stuff + things *@ + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_CSharp_Static(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @using System + @code + { + private static bool _isStatic; + + public void M() + { + if (_isStatic) + { + } + } + } + """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile); + } + + [Theory] + [CombinatorialData] + public async Task GetSemanticTokens_Legacy_Model(bool colorBackground, bool miscellaneousFile) + { + var input = """ + @using System + @model SampleApp.Pages.ErrorModel + +
+ + @{ + @Model.ToString(); + } + +
+ """; + + await VerifySemanticTokensAsync(input, colorBackground, miscellaneousFile, fileKind: RazorFileKind.Legacy); + } + private async Task VerifySemanticTokensAsync( string input, bool colorBackground, diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions.txt new file mode 100644 index 00000000000..0b6a278fa0a --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions.txt @@ -0,0 +1,21 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 8 struct [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property [static] [Now] +2 0 1 razorTransition [] [@] +0 1 1 razorTransition [] [(] +0 1 7 string [] ["hello"] +0 8 1 operator [] [+] +0 2 1 string [] ["] +0 1 2 stringEscapeCharacter [] [\\] +0 2 2 string [] [n"] +0 3 1 operator [] [+] +0 2 7 string [] ["world"] +0 8 1 operator [] [+] +0 2 11 class [static] [Environment] +0 11 1 operator [] [.] +0 1 7 property [static] [NewLine] +0 8 1 operator [] [+] +0 2 14 string [] ["how are you?"] +0 14 1 razorTransition [] [)] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt new file mode 100644 index 00000000000..0b6a278fa0a --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_misc_file.txt @@ -0,0 +1,21 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 8 struct [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property [static] [Now] +2 0 1 razorTransition [] [@] +0 1 1 razorTransition [] [(] +0 1 7 string [] ["hello"] +0 8 1 operator [] [+] +0 2 1 string [] ["] +0 1 2 stringEscapeCharacter [] [\\] +0 2 2 string [] [n"] +0 3 1 operator [] [+] +0 2 7 string [] ["world"] +0 8 1 operator [] [+] +0 2 11 class [static] [Environment] +0 11 1 operator [] [.] +0 1 7 property [static] [NewLine] +0 8 1 operator [] [+] +0 2 14 string [] ["how are you?"] +0 14 1 razorTransition [] [)] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background.txt new file mode 100644 index 00000000000..4fad6e6ce06 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [razorCode] [@] +0 1 8 struct [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property [static, razorCode] [Now] +2 0 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [(] +0 1 7 string [razorCode] ["hello"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 string [razorCode] ["] +0 1 2 stringEscapeCharacter [razorCode] [\\] +0 2 2 string [razorCode] [n"] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 7 string [razorCode] ["world"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 11 class [static, razorCode] [Environment] +0 11 1 operator [razorCode] [.] +0 1 7 property [static, razorCode] [NewLine] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 14 string [razorCode] ["how are you?"] +0 14 1 razorTransition [razorCode] [)] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt new file mode 100644 index 00000000000..4fad6e6ce06 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/Expressions_with_background_misc_file.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [razorCode] [@] +0 1 8 struct [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property [static, razorCode] [Now] +2 0 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [(] +0 1 7 string [razorCode] ["hello"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 string [razorCode] ["] +0 1 2 stringEscapeCharacter [razorCode] [\\] +0 2 2 string [razorCode] [n"] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 7 string [razorCode] ["world"] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 11 class [static, razorCode] [Environment] +0 11 1 operator [razorCode] [.] +0 1 7 property [static, razorCode] [NewLine] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [+] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 14 string [razorCode] ["how are you?"] +0 14 1 razorTransition [razorCode] [)] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt new file mode 100644 index 00000000000..b71e3385aae --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static.txt @@ -0,0 +1,26 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 6 keyword [] [static] +0 7 4 keyword [] [bool] +0 5 9 field [static] [_isStatic] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 controlKeyword [] [if] +0 3 1 punctuation [] [(] +0 1 9 field [static] [_isStatic] +0 9 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt new file mode 100644 index 00000000000..b71e3385aae --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_misc_file.txt @@ -0,0 +1,26 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 6 keyword [] [static] +0 7 4 keyword [] [bool] +0 5 9 field [static] [_isStatic] +0 9 1 punctuation [] [;] +2 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 controlKeyword [] [if] +0 3 1 punctuation [] [(] +0 1 9 field [static] [_isStatic] +0 9 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt new file mode 100644 index 00000000000..2d785ec4e47 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background.txt @@ -0,0 +1,40 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [static] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [bool] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 9 field [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 controlKeyword [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 9 field [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt new file mode 100644 index 00000000000..2d785ec4e47 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_CSharp_Static_with_background_misc_file.txt @@ -0,0 +1,40 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 6 keyword [razorCode] [static] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [bool] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 9 field [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [;] +2 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 controlKeyword [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 9 field [static, razorCode] [_isStatic] +0 9 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt new file mode 100644 index 00000000000..c089116a8b8 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model.txt @@ -0,0 +1,28 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [] [SampleApp] +0 9 1 operator [] [.] +0 1 5 variable [] [Pages] +0 5 1 operator [] [.] +0 1 10 variable [] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [] [@] +0 1 1 razorTransition [] [{] +1 8 1 razorTransition [] [@] +0 1 5 property [] [Model] +0 5 1 operator [] [.] +0 1 8 variable [] [ToString] +0 8 1 punctuation [] [(] +0 1 1 punctuation [] [)] +0 1 1 punctuation [] [;] +1 4 1 razorTransition [] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt new file mode 100644 index 00000000000..9fcd05694ff --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_misc_file.txt @@ -0,0 +1,28 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [] [SampleApp] +0 9 1 operator [] [.] +0 1 5 variable [] [Pages] +0 5 1 operator [] [.] +0 1 10 variable [] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [] [@] +0 1 1 razorTransition [] [{] +1 8 1 razorTransition [] [@] +0 1 5 variable [] [Model] +0 5 1 operator [] [.] +0 1 8 variable [] [ToString] +0 8 1 punctuation [] [(] +0 1 1 punctuation [] [)] +0 1 1 punctuation [] [;] +1 4 1 razorTransition [] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt new file mode 100644 index 00000000000..66078d5136c --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [razorCode] [SampleApp] +0 9 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Pages] +0 5 1 operator [razorCode] [.] +0 1 10 variable [razorCode] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [{] +1 8 1 razorTransition [razorCode] [@] +0 1 5 property [razorCode] [Model] +0 5 1 operator [razorCode] [.] +0 1 8 variable [razorCode] [ToString] +0 8 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] [;] +1 4 1 razorTransition [razorCode] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt new file mode 100644 index 00000000000..f40a12f91d6 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Legacy_Model_with_background_misc_file.txt @@ -0,0 +1,29 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 5 razorDirective [] [model] +0 6 9 variable [razorCode] [SampleApp] +0 9 1 operator [razorCode] [.] +0 1 5 variable [razorCode] [Pages] +0 5 1 operator [razorCode] [.] +0 1 10 variable [razorCode] [ErrorModel] +2 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +2 4 1 razorTransition [razorCode] [@] +0 1 1 razorTransition [razorCode] [{] +1 8 1 razorTransition [razorCode] [@] +0 1 5 variable [razorCode] [Model] +0 5 1 operator [razorCode] [.] +0 1 8 variable [razorCode] [ToString] +0 8 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +0 1 1 punctuation [razorCode] [;] +1 4 1 razorTransition [razorCode] [}] +2 0 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_misc_file.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..387010ee930 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_CommentAsync_with_background_misc_file.txt @@ -0,0 +1,6 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 11 razorComment [] [ A comment ] +0 11 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_misc_file.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..a60a8821ae3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentAsync_with_background_misc_file.txt @@ -0,0 +1,7 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 5 razorComment [] [stuff] +1 0 7 razorComment [] [things ] +0 7 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_misc_file.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt new file mode 100644 index 00000000000..31196b3e573 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentMidlineAsync_with_background_misc_file.txt @@ -0,0 +1,12 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 1 markupTagDelimiter [] [/] +0 1 1 markupTagDelimiter [] [>] +0 1 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +1 0 3 razorComment [] [skd] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_LF_with_background_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt new file mode 100644 index 00000000000..8c8488c5abc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_MultiLineCommentWithBlankLines_with_background_misc_file.txt @@ -0,0 +1,10 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorCommentTransition [] [@] +0 1 1 razorCommentStar [] [*] +0 1 4 razorComment [] [ kdl] +2 0 3 razorComment [] [skd] +1 0 4 razorComment [] [ ] +1 0 19 razorComment [] [ sdfasdfasdf] +1 0 3 razorComment [] [slf] +0 3 1 razorCommentStar [] [*] +0 1 1 razorCommentTransition [] [@] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt new file mode 100644 index 00000000000..95aeaea58a7 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 4 keyword [] [void] +0 5 14 method [] [BidsByShipment] +0 14 1 punctuation [] [(] +0 1 6 keyword [] [string] +0 7 11 parameter [] [generatedId] +0 11 1 punctuation [] [,] +0 2 3 keyword [] [int] +0 4 4 parameter [] [bids] +0 4 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 controlKeyword [] [if] +0 3 1 punctuation [] [(] +0 1 4 parameter [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [] [@] +0 1 2 controlKeyword [] [if] +0 2 1 punctuation [] [(] +0 1 4 parameter [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 16 1 punctuation [] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [] [@] +0 1 8 struct [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property [static] [Now] +0 3 7 razorDirective [] [] +1 16 1 punctuation [] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt new file mode 100644 index 00000000000..95aeaea58a7 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_misc_file.txt @@ -0,0 +1,55 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 4 7 keyword [] [private] +0 8 4 keyword [] [void] +0 5 14 method [] [BidsByShipment] +0 14 1 punctuation [] [(] +0 1 6 keyword [] [string] +0 7 11 parameter [] [generatedId] +0 11 1 punctuation [] [,] +0 2 3 keyword [] [int] +0 4 4 parameter [] [bids] +0 4 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 2 controlKeyword [] [if] +0 3 1 punctuation [] [(] +0 1 4 parameter [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 8 1 punctuation [] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [] [@] +0 1 2 controlKeyword [] [if] +0 2 1 punctuation [] [(] +0 1 4 parameter [] [bids] +0 5 1 operator [] [>] +0 2 1 number [] [0] +0 1 1 punctuation [] [)] +1 16 1 punctuation [] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [] [@] +0 1 8 struct [] [DateTime] +0 8 1 operator [] [.] +0 1 3 property [static] [Now] +0 3 7 razorDirective [] [] +1 16 1 punctuation [] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 8 1 punctuation [] [}] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt new file mode 100644 index 00000000000..56f63864b66 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background.txt @@ -0,0 +1,74 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 14 method [razorCode] [BidsByShipment] +0 14 1 punctuation [razorCode] [(] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 11 parameter [razorCode] [generatedId] +0 11 1 punctuation [razorCode] [,] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 keyword [razorCode] [int] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 4 parameter [razorCode] [bids] +0 4 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 controlKeyword [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 parameter [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [razorCode] [@] +0 1 2 controlKeyword [razorCode] [if] +0 2 1 punctuation [razorCode] [(] +0 1 4 parameter [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [razorCode] [@] +0 1 8 struct [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property [static, razorCode] [Now] +0 3 7 razorDirective [] [] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt new file mode 100644 index 00000000000..56f63864b66 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTextDirectives_with_background_misc_file.txt @@ -0,0 +1,74 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 9 razorDirective [] [functions] +0 10 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 7 keyword [razorCode] [private] +0 7 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 14 method [razorCode] [BidsByShipment] +0 14 1 punctuation [razorCode] [(] +0 1 6 keyword [razorCode] [string] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 11 parameter [razorCode] [generatedId] +0 11 1 punctuation [razorCode] [,] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 keyword [razorCode] [int] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 4 parameter [razorCode] [bids] +0 4 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 2 controlKeyword [razorCode] [if] +0 2 1 markupTextLiteral [razorCode] [ ] +0 1 1 punctuation [razorCode] [(] +0 1 4 parameter [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [{] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupElement [] [a] +0 2 5 markupAttribute [] [class] +0 5 1 markupOperator [] [=] +0 1 1 markupAttributeQuote [] ["] +0 1 1 markupAttributeQuote [] ["] +0 1 7 markupAttribute [] [Thing""] +0 7 1 markupTagDelimiter [] [>] +1 16 1 razorTransition [razorCode] [@] +0 1 2 controlKeyword [razorCode] [if] +0 2 1 punctuation [razorCode] [(] +0 1 4 parameter [razorCode] [bids] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 number [razorCode] [0] +0 1 1 punctuation [razorCode] [)] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [{] +1 20 6 razorDirective [] [] +0 6 1 razorTransition [razorCode] [@] +0 1 8 struct [razorCode] [DateTime] +0 8 1 operator [razorCode] [.] +0 1 3 property [static, razorCode] [Now] +0 3 7 razorDirective [] [] +1 0 16 markupTextLiteral [razorCode] [ ] +0 16 1 punctuation [razorCode] [}] +1 12 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 1 markupElement [] [a] +0 1 1 markupTagDelimiter [] [>] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 1 punctuation [razorCode] [}] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt new file mode 100644 index 00000000000..ae2c47deaa2 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions.txt @@ -0,0 +1,23 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 4 6 delegate [] [Action] +0 6 1 punctuation [] [<] +0 1 6 keyword [] [object] +0 6 1 punctuation [] [>] +0 2 3 field [] [abc] +0 4 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt new file mode 100644 index 00000000000..ae2c47deaa2 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_misc_file.txt @@ -0,0 +1,23 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [] [using] +0 6 6 namespace [] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 4 6 delegate [] [Action] +0 6 1 punctuation [] [<] +0 1 6 keyword [] [object] +0 6 1 punctuation [] [>] +0 2 3 field [] [abc] +0 4 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt new file mode 100644 index 00000000000..6c668627153 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background.txt @@ -0,0 +1,27 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 delegate [razorCode] [Action] +0 6 1 punctuation [razorCode] [<] +0 1 6 keyword [razorCode] [object] +0 6 1 punctuation [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 field [razorCode] [abc] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt new file mode 100644 index 00000000000..6c668627153 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/GetSemanticTokens_Razor_NestedTransitions_with_background_misc_file.txt @@ -0,0 +1,27 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 razorTransition [] [@] +0 1 5 keyword [razorCode] [using] +0 5 1 markupTextLiteral [razorCode] [ ] +0 1 6 namespace [razorCode] [System] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +0 5 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 delegate [razorCode] [Action] +0 6 1 punctuation [razorCode] [<] +0 1 6 keyword [razorCode] [object] +0 6 1 punctuation [razorCode] [>] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 3 field [razorCode] [abc] +0 3 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 4 markupElement [] [span] +0 4 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment.txt new file mode 100644 index 00000000000..bd3ad05091b --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment.txt @@ -0,0 +1,31 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 delegate [] [RenderFragment] +0 15 1 variable [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt new file mode 100644 index 00000000000..f77a89a6e24 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_misc_file.txt @@ -0,0 +1,31 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 4 6 keyword [] [public] +0 7 4 keyword [] [void] +0 5 1 method [] [M] +0 1 1 punctuation [] [(] +0 1 1 punctuation [] [)] +1 4 1 punctuation [] [{] +1 8 14 variable [] [RenderFragment] +0 15 1 variable [] [x] +0 2 1 operator [] [=] +0 2 1 razorTransition [] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [] [;] +1 4 1 punctuation [] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt new file mode 100644 index 00000000000..f7bd93c9a42 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 delegate [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 variable [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}] diff --git a/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt new file mode 100644 index 00000000000..5d59d1104f6 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/TestFiles/SemanticTokens/RenderFragment_with_background_misc_file.txt @@ -0,0 +1,39 @@ +Line Δ, Char Δ, Length, Type, Modifier(s), Text +0 0 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +1 0 1 razorTransition [] [@] +0 1 4 razorDirective [] [code] +1 0 1 razorTransition [] [{] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 6 keyword [razorCode] [public] +0 6 1 markupTextLiteral [razorCode] [ ] +0 1 4 keyword [razorCode] [void] +0 4 1 markupTextLiteral [razorCode] [ ] +0 1 1 method [razorCode] [M] +0 1 1 punctuation [razorCode] [(] +0 1 1 punctuation [razorCode] [)] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [{] +1 0 8 markupTextLiteral [razorCode] [ ] +0 8 14 variable [razorCode] [RenderFragment] +0 14 1 markupTextLiteral [razorCode] [ ] +0 1 1 variable [razorCode] [x] +0 1 1 markupTextLiteral [razorCode] [ ] +0 1 1 operator [razorCode] [=] +0 2 1 razorTransition [razorCode] [@] +0 1 1 markupTagDelimiter [] [<] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 18 1 markupTagDelimiter [] [<] +0 1 1 markupTagDelimiter [] [/] +0 1 3 markupElement [] [div] +0 3 1 markupTagDelimiter [] [>] +0 1 1 punctuation [razorCode] [;] +1 0 4 markupTextLiteral [razorCode] [ ] +0 4 1 punctuation [razorCode] [}] +1 0 1 razorTransition [] [}]