Skip to content

Commit

Permalink
Correct for test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marcarro committed Jul 22, 2024
1 parent 2908e6c commit 9d7a565
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,38 +134,7 @@ internal sealed class ExtractToCodeBehindCodeActionResolver(
};
}

<<<<<<< HEAD
private async Task<string> GenerateCodeBehindClassAsync(CodeAnalysis.Razor.ProjectSystem.IProjectSnapshot project, Uri codeBehindUri, string className, string namespaceName, string contents, RazorCodeDocument razorCodeDocument, CancellationToken cancellationToken)
=======
/// <summary>
/// Generate a file path with adjacent to our input path that has the
/// correct codebehind extension, using numbers to differentiate from
/// any collisions.
/// </summary>
/// <param name="path">The origin file path.</param>
/// <returns>A non-existent file path with the same base name and a codebehind extension.</returns>
private static string GenerateCodeBehindPath(string path)
{
var baseFileName = Path.GetFileNameWithoutExtension(path);
var extension = Path.GetExtension(path);
var directoryName = Path.GetDirectoryName(path).AssumeNotNull();

var n = 0;
string codeBehindPath;
do
{
var identifier = n > 0 ? n.ToString(CultureInfo.InvariantCulture) : string.Empty; // Make it look nice

codeBehindPath = Path.Combine(directoryName, $"{baseFileName}{identifier}{extension}.cs");
n++;
}
while (File.Exists(codeBehindPath));

return codeBehindPath;
}

private async Task<string> GenerateCodeBehindClassAsync(IProjectSnapshot project, Uri codeBehindUri, string className, string namespaceName, string contents, RazorCodeDocument razorCodeDocument, CancellationToken cancellationToken)
>>>>>>> upstream/features/extract-to-component
{
using var _ = StringBuilderPool.GetPooledObject(out var builder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Razor;

internal sealed class ExtractToNewComponentCodeActionResolver(
IDocumentContextFactory documentContextFactory,
LanguageServerFeatureOptions languageServerFeatureOptions,
IClientConnection clientConnection) : IRazorCodeActionResolver
LanguageServerFeatureOptions languageServerFeatureOptions) : IRazorCodeActionResolver
{

private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public async Task Handle_InvalidFileKind()
var commandOrCodeActionContainer = await provider.ProvideAsync(context, default);

// Assert
Assert.Null(commandOrCodeActionContainer);
Assert.Empty(commandOrCodeActionContainer);
}

private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionParams request, SourceLocation location, string filePath, string text, bool supportsFileCreation = true)
Expand Down Expand Up @@ -94,7 +94,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP

var sourceText = SourceText.From(text);

var context = new RazorCodeActionContext(request, documentSnapshot, codeDocument, location, sourceText, supportsFileCreation, supportsCodeActionResolve: true);
var context = new RazorCodeActionContext(request, documentSnapshot, codeDocument, location, sourceText, supportsFileCreation, SupportsCodeActionResolve: true);

return context;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

using System;
using System.Globalization;
using System.IO;

Expand Down

0 comments on commit 9d7a565

Please sign in to comment.