Merge branch 'rel/vs15.7' into release/2.1

This commit is contained in:
Ryan Nowak 2018-03-19 15:11:49 -07:00
commit d72e914fe9
2 changed files with 16 additions and 5 deletions

View File

@ -24,6 +24,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
"MVC-2.0", "MVC-2.0",
new[] { new FallbackRazorExtension("MVC-2.0"), }); new[] { new FallbackRazorExtension("MVC-2.0"), });
public static readonly RazorConfiguration MVC_2_1 = new FallbackRazorConfiguration(
RazorLanguageVersion.Version_2_1,
"MVC-2.1",
new[] { new FallbackRazorExtension("MVC-2.1"), });
public static RazorConfiguration SelectConfiguration(Version version) public static RazorConfiguration SelectConfiguration(Version version)
{ {
if (version.Major == 1 && version.Minor == 0) if (version.Major == 1 && version.Minor == 0)
@ -38,9 +44,13 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
{ {
return MVC_2_0; return MVC_2_0;
} }
else if (version.Major == 2 && version.Minor == 1)
{
return MVC_2_1;
}
else else
{ {
return MVC_2_0; return MVC_2_1;
} }
} }

View File

@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.Editor.Razor
{ {
internal class DefaultProjectEngineFactoryService : RazorProjectEngineFactoryService internal class DefaultProjectEngineFactoryService : RazorProjectEngineFactoryService
{ {
private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_0; private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_1;
private readonly Workspace _workspace; private readonly Workspace _workspace;
private readonly IFallbackProjectEngineFactory _defaultFactory; private readonly IFallbackProjectEngineFactory _defaultFactory;
@ -135,9 +135,10 @@ namespace Microsoft.VisualStudio.Editor.Razor
// things also. // things also.
configure = configure ?? ((b) => { }); configure = configure ?? ((b) => { });
// The default configuration currently matches MVC-2.0. Beyond MVC-2.0 we added SDK support for // The default configuration currently matches the newest MVC configuration.
// properly detecting project versions, so that's a good version to assume when we can't find a //
// configuration. // We typically want this because the language adds features over time - we don't want to a bunch of errors
// to show up when a document is first opened, and then go away when the configuration loads, we'd prefer the opposite.
var configuration = project?.Configuration ?? DefaultConfiguration; var configuration = project?.Configuration ?? DefaultConfiguration;
// If there's no factory to handle the configuration then fall back to a very basic configuration. // If there's no factory to handle the configuration then fall back to a very basic configuration.