aspnetcore/tooling/Microsoft.VisualStudio.Lang.../BlazorProjectEngineFactory.cs

28 lines
1.1 KiB
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Blazor.Razor;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis.Razor;
namespace Microsoft.VisualStudio.LanguageServices.Blazor
{
[ExportCustomProjectEngineFactory("Blazor-0.1", SupportsSerialization = false)]
internal class BlazorProjectEngineFactory : IProjectEngineFactory
{
public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action<RazorProjectEngineBuilder> configure)
{
return RazorProjectEngine.Create(configuration, fileSystem, b =>
{
configure?.Invoke(b);
new BlazorExtensionInitializer().Initialize(b);
var classifier = b.Features.OfType<ComponentDocumentClassifierPass>().Single();
classifier.MangleClassNames = true;
});
}
}
}