Skip to content

Commit f05466d

Browse files
committed
PR Feedback
1 parent 1f221b6 commit f05466d

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33

44
using System.Threading;
55
using System.Threading.Tasks;
6-
using ICSharpCode.Decompiler.Util;
7-
using Microsoft.AspNetCore.Razor.Language;
86
using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts;
9-
using Microsoft.AspNetCore.Razor.LanguageServer.Formatting;
107
using Microsoft.AspNetCore.Razor.LanguageServer.Hosting;
118
using Microsoft.CodeAnalysis.Razor.Formatting;
129
using Microsoft.CodeAnalysis.Razor.Logging;
13-
using Microsoft.CodeAnalysis.Razor.Protocol;
14-
using Microsoft.CodeAnalysis.Razor.Workspaces.Utilities;
15-
using Microsoft.CodeAnalysis.Text;
10+
using Microsoft.CodeAnalysis.Razor.Utilities;
1611

1712
namespace Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag;
1813

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Utilities/WrapWithTagHelper.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Microsoft.CodeAnalysis.Razor.Protocol;
77
using Microsoft.CodeAnalysis.Text;
88

9-
namespace Microsoft.CodeAnalysis.Razor.Workspaces.Utilities;
9+
namespace Microsoft.CodeAnalysis.Razor.Utilities;
1010

1111
internal static class WrapWithTagHelper
1212
{
@@ -87,12 +87,9 @@ public static bool TryGetValidWrappingRange(RazorCodeDocument codeDocument, Line
8787
{
8888
// Pretend we're in Html so the rest of the logic can continue
8989
wrappingRange = sourceText.GetLinePositionSpan(codeBlock.Span);
90-
languageKind = RazorLanguageKind.Html;
90+
return true;
9191
}
92-
}
9392

94-
if (languageKind is not RazorLanguageKind.Html)
95-
{
9693
return false;
9794
}
9895

src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/WrapWithTag/RemoteWrapWithTagService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using Microsoft.CodeAnalysis.ExternalAccess.Razor;
77
using Microsoft.CodeAnalysis.Razor.Remote;
8-
using Microsoft.CodeAnalysis.Razor.Workspaces.Utilities;
8+
using Microsoft.CodeAnalysis.Razor.Utilities;
99
using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem;
1010
using Microsoft.CodeAnalysis.Text;
1111
using Response = Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse<Microsoft.CodeAnalysis.Text.LinePositionSpan>;

src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWrapWithTagEndpoint.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System;
45
using System.Composition;
56
using System.Linq;
67
using System.Threading;
@@ -72,7 +73,7 @@ internal sealed class CohostWrapWithTagEndpoint(
7273

7374
// If the Html response has ~s in it, then we need to clean them up.
7475
if (htmlResponse?.TextEdits is { } edits &&
75-
edits.Any(static e => e.NewText.Contains("~")))
76+
edits.Any(static e => e.NewText.Contains('~')))
7677
{
7778
// To do this we don't actually need to go to OOP, we just need a SourceText with the Html document,
7879
// and we already have that in a virtual buffer, because it's what the above request was made against.
@@ -90,7 +91,7 @@ internal sealed class CohostWrapWithTagEndpoint(
9091
return null;
9192
}
9293

93-
var htmlSourceText = SourceText.From(htmlDocument.Snapshot.GetText());
94+
var htmlSourceText = htmlDocument.Snapshot.AsText();
9495
htmlResponse.TextEdits = FormattingUtilities.FixHtmlTextEdits(htmlSourceText, edits);
9596
}
9697

src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostWrapWithTagEndpointTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ private async Task VerifyWrapWithTagAsync(TestCode input, string? expected, VSIn
198198
if (htmlDocument is not null)
199199
{
200200
var snapshot = new StringTextSnapshot(htmlDocument);
201+
var buffer = new TestTextBuffer(snapshot);
201202
var htmlSnapshot = new HtmlVirtualDocumentSnapshot(documentUri, snapshot, hostDocumentSyncVersion: 1, state: null);
202203
var documentSnapshot = new TestLSPDocumentSnapshot(documentUri, version: 1, htmlSnapshot);
203204
documentManager.AddDocument(documentUri, documentSnapshot);

0 commit comments

Comments
 (0)