зеркало из https://github.com/dotnet/razor.git
PR Feedback
This commit is contained in:
Родитель
c349de7362
Коммит
a7d127c021
|
@ -5,7 +5,6 @@ using System.Collections.Immutable;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.PooledObjects;
|
||||
using Microsoft.CodeAnalysis.ExternalAccess.Razor;
|
||||
using Microsoft.CodeAnalysis.Razor.Diagnostics;
|
||||
using Microsoft.CodeAnalysis.Razor.Protocol;
|
||||
|
@ -48,12 +47,10 @@ internal sealed class RemoteDiagnosticsService(in ServiceArgs args) : RazorDocum
|
|||
// Yes, CSharpDocument.Documents are the Razor diagnostics. Don't ask.
|
||||
var razorDiagnostics = codeDocument.GetCSharpDocument().Diagnostics;
|
||||
|
||||
using var allDiagnostics = new PooledArrayBuilder<LspDiagnostic>(capacity: razorDiagnostics.Length + csharpDiagnostics.Length + htmlDiagnostics.Length);
|
||||
|
||||
allDiagnostics.AddRange(RazorDiagnosticConverter.Convert(razorDiagnostics, codeDocument.Source.Text, context.Snapshot));
|
||||
allDiagnostics.AddRange(await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.CSharp, csharpDiagnostics, context.Snapshot));
|
||||
allDiagnostics.AddRange(await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.Html, htmlDiagnostics, context.Snapshot));
|
||||
|
||||
return allDiagnostics.DrainToImmutable();
|
||||
return [
|
||||
.. RazorDiagnosticConverter.Convert(razorDiagnostics, codeDocument.Source.Text, context.Snapshot),
|
||||
.. await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.CSharp, csharpDiagnostics, context.Snapshot),
|
||||
.. await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.Html, htmlDiagnostics, context.Snapshot)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,15 +136,15 @@ public abstract class CohostEndpointTestBase(ITestOutputHelper testOutputHelper)
|
|||
private static TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace workspace, ProjectId projectId, string projectName, DocumentId documentId, string documentFilePath, string contents, (string fileName, string contents)[]? additionalFiles)
|
||||
{
|
||||
var projectInfo = ProjectInfo
|
||||
.Create(
|
||||
projectId,
|
||||
VersionStamp.Create(),
|
||||
name: projectName,
|
||||
assemblyName: projectName,
|
||||
LanguageNames.CSharp,
|
||||
documentFilePath)
|
||||
.WithDefaultNamespace(TestProjectData.SomeProject.RootNamespace)
|
||||
.WithMetadataReferences(AspNet80.ReferenceInfos.All.Select(r => r.Reference));
|
||||
.Create(
|
||||
projectId,
|
||||
VersionStamp.Create(),
|
||||
name: projectName,
|
||||
assemblyName: projectName,
|
||||
LanguageNames.CSharp,
|
||||
documentFilePath)
|
||||
.WithDefaultNamespace(TestProjectData.SomeProject.RootNamespace)
|
||||
.WithMetadataReferences(AspNet80.ReferenceInfos.All.Select(r => r.Reference));
|
||||
|
||||
var solution = workspace.CurrentSolution.AddProject(projectInfo);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче