зеркало из https://github.com/dotnet/razor.git
Remove unused parameter
This commit is contained in:
Родитель
d87ad016dd
Коммит
b7cd05e453
|
@ -26,13 +26,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting;
|
|||
internal class DocumentOnTypeFormattingEndpoint(
|
||||
IRazorFormattingService razorFormattingService,
|
||||
IHtmlFormatter htmlFormatter,
|
||||
IDocumentMappingService documentMappingService,
|
||||
RazorLSPOptionsMonitor optionsMonitor,
|
||||
ILoggerFactory loggerFactory)
|
||||
: IRazorRequestHandler<DocumentOnTypeFormattingParams, TextEdit[]?>, ICapabilitiesProvider
|
||||
{
|
||||
private readonly IRazorFormattingService _razorFormattingService = razorFormattingService;
|
||||
private readonly IDocumentMappingService _documentMappingService = documentMappingService;
|
||||
private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor;
|
||||
private readonly IHtmlFormatter _htmlFormatter = htmlFormatter;
|
||||
private readonly ILogger _logger = loggerFactory.GetOrCreateLogger<DocumentOnTypeFormattingEndpoint>();
|
||||
|
|
|
@ -310,7 +310,7 @@ internal class RazorFormattingService : IRazorFormattingService
|
|||
/// If LF line endings are more prevalent, it removes any CR characters from the text edits
|
||||
/// to ensure consistency with the LF style.
|
||||
/// </summary>
|
||||
private TextEdit[] NormalizeLineEndings(SourceText originalText, TextEdit[] edits)
|
||||
private static TextEdit[] NormalizeLineEndings(SourceText originalText, TextEdit[] edits)
|
||||
{
|
||||
if (originalText.HasLFLineEndings())
|
||||
{
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer;
|
||||
using Microsoft.CodeAnalysis.Razor.DocumentMapping;
|
||||
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
|
||||
using Microsoft.CodeAnalysis.Razor.Protocol;
|
||||
using Microsoft.VisualStudio.LanguageServer.Protocol;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
@ -23,12 +20,11 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
// Arrange
|
||||
var uri = new Uri("file://path/test.razor");
|
||||
var formattingService = new DummyRazorFormattingService();
|
||||
var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory);
|
||||
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: false);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams { TextDocument = new TextDocumentIdentifier { Uri = uri, } };
|
||||
var requestContext = CreateRazorRequestContext(documentContext: null);
|
||||
|
||||
|
@ -52,12 +48,11 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
|
||||
var documentContext = CreateDocumentContext(new Uri("file://path/testDifferentFile.razor"), codeDocument);
|
||||
var formattingService = new DummyRazorFormattingService();
|
||||
var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory);
|
||||
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: true);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams()
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier { Uri = uri, },
|
||||
|
@ -87,12 +82,11 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
|
||||
var documentContext = CreateDocumentContext(uri, codeDocument);
|
||||
var formattingService = new DummyRazorFormattingService();
|
||||
var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory);
|
||||
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: true);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams()
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier { Uri = uri, },
|
||||
|
@ -123,12 +117,10 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
var documentContext = CreateDocumentContext(uri, codeDocument);
|
||||
var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Html);
|
||||
|
||||
var documentMappingService = new Mock<IDocumentMappingService>(MockBehavior.Strict);
|
||||
documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html);
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: true);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams()
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier { Uri = uri, },
|
||||
|
@ -159,12 +151,10 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
var documentContext = CreateDocumentContext(uri, codeDocument);
|
||||
var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Razor);
|
||||
|
||||
var documentMappingService = new Mock<IDocumentMappingService>(MockBehavior.Strict);
|
||||
documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor);
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: true);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams()
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier { Uri = uri, },
|
||||
|
@ -194,12 +184,11 @@ public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput)
|
|||
|
||||
var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument);
|
||||
var formattingService = new DummyRazorFormattingService();
|
||||
var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory);
|
||||
|
||||
var optionsMonitor = GetOptionsMonitor(enableFormatting: true);
|
||||
var htmlFormatter = new TestHtmlFormatter();
|
||||
var endpoint = new DocumentOnTypeFormattingEndpoint(
|
||||
formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory);
|
||||
formattingService, htmlFormatter, optionsMonitor, LoggerFactory);
|
||||
var @params = new DocumentOnTypeFormattingParams()
|
||||
{
|
||||
TextDocument = new TextDocumentIdentifier { Uri = uri, },
|
||||
|
|
Загрузка…
Ссылка в новой задаче