未验证 提交 4ccb6f5c 编写于 作者: J Joey Robichaud 提交者: GitHub

Merge pull request #36042 from JoeRobich/editorconfig-feature-flag

Add EditorConfig feature flag
......@@ -19,7 +19,7 @@ The minimal required version of .NET Framework is 4.7.2.
- Ensure C#, VB, MSBuild, .NET Core and Visual Studio Extensibility are included in the selected work loads
- Ensure Visual Studio is on Version "RC1" or greater
- Ensure "Use Previews" is checked in Tools -> Options -> Projects and Solutions -> .NET Core
1. [.NET Core SDK 3.0 Preview 6](https://dotnet.microsoft.com/download/dotnet-core/3.0) [Windows x64 installer](https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview6-011773/dotnet-sdk-3.0.100-preview6-011773-win-x64.exe )
1. [.NET Core SDK 3.0 Preview 6](https://dotnet.microsoft.com/download/dotnet-core/3.0) [Windows x64 installer](https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview6-012105/dotnet-sdk-3.0.100-preview6-012105-win-x64.exe )
1. [PowerShell 5.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on Windows 7. The download link is under the "upgrading existing Windows PowerShell" heading.
1. Run Restore.cmd
1. Open Roslyn.sln
......
......@@ -69,7 +69,7 @@
<MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>14.3.25407-alpha</MicrosoftInternalVisualStudioShellInterop140DesignTimeVersion>
<MicrosoftMetadataVisualizerVersion>1.0.0-beta1-63011-01</MicrosoftMetadataVisualizerVersion>
<MicrosoftMSXMLVersion>8.0.0.0-alpha</MicrosoftMSXMLVersion>
<MicrosoftNetCompilersToolsetVersion>3.1.0-beta1-19164-01</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>3.2.0-beta2-19275-07</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCoreAnalyzersVersion>$(RoslynDiagnosticsNugetPackageVersion)</MicrosoftNetCoreAnalyzersVersion>
<MicrosoftNetCoreILAsmVersion>3.0.0-preview6-27706-71</MicrosoftNetCoreILAsmVersion>
<MicrosoftNetCoreILDasmVersion>3.0.0-preview6-27706-71</MicrosoftNetCoreILDasmVersion>
......@@ -287,6 +287,7 @@
<UsingToolVisualStudioIbcTraining>true</UsingToolVisualStudioIbcTraining>
<UsingToolXliff>true</UsingToolXliff>
<UsingToolXUnit>true</UsingToolXUnit>
<DiscoverEditorConfigFiles>true</DiscoverEditorConfigFiles>
<!--
When using a bootstrap builder we don't want to use the Microsoft.Net.Compilers.Toolset package but
rather explicitly override it.
......
{
"tools": {
"dotnet": "3.0.100-preview6-011773",
"dotnet": "3.0.100-preview6-012105",
"vs": {
"version": "16.0"
},
......
......@@ -4,7 +4,6 @@
using System.Composition;
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Experiments;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.EditorConfig;
......@@ -35,7 +34,7 @@ class LegacyEditorConfigDocumentOptionsProviderFactory : IDocumentOptionsProvide
public IDocumentOptionsProvider TryCreate(Workspace workspace)
{
if (EditorConfigDocumentOptionsProviderFactory.ShouldUseNativeEditorConfigSupport)
if (EditorConfigDocumentOptionsProviderFactory.ShouldUseNativeEditorConfigSupport(workspace))
{
// If the native support exists, then we'll simply disable this one
return null;
......
......@@ -10,7 +10,9 @@ namespace Microsoft.VisualStudio.IntegrationTest.Utilities
{
public sealed class LegacyEditorConfigCondition : ExecutionCondition
{
public override bool ShouldSkip => EditorConfigDocumentOptionsProviderFactory.ShouldUseNativeEditorConfigSupport;
// Run legacy .editorconfig tests until our infrastructure is ready to test the
// compiler support. Waiting for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/839836
public override bool ShouldSkip => false;
public override string SkipReason => "Test is only supported with our legacy .editorconfig support";
}
......
......@@ -14,8 +14,6 @@ namespace Microsoft.CodeAnalysis.Options.EditorConfig
[Export(typeof(IDocumentOptionsProviderFactory)), Shared]
internal sealed class EditorConfigDocumentOptionsProviderFactory : IDocumentOptionsProviderFactory
{
public static bool ShouldUseNativeEditorConfigSupport = Environment.GetEnvironmentVariable("ROSLYN_EDITORCONFIG_SUPPORT") == "native";
[ImportingConstructor]
public EditorConfigDocumentOptionsProviderFactory()
{
......@@ -23,7 +21,7 @@ public EditorConfigDocumentOptionsProviderFactory()
public IDocumentOptionsProvider TryCreate(Workspace workspace)
{
if (!ShouldUseNativeEditorConfigSupport)
if (!ShouldUseNativeEditorConfigSupport(workspace))
{
// Simply disable if the feature isn't on
return null;
......@@ -32,6 +30,12 @@ public IDocumentOptionsProvider TryCreate(Workspace workspace)
return new EditorConfigDocumentOptionsProvider(workspace.Services.GetService<IErrorLoggerService>());
}
public static bool ShouldUseNativeEditorConfigSupport(Workspace workspace)
{
var experimentationService = workspace.Services.GetService<IExperimentationService>();
return experimentationService.IsExperimentEnabled(WellKnownExperimentNames.NativeEditorConfigSupport);
}
private class EditorConfigDocumentOptionsProvider : IDocumentOptionsProvider
{
private readonly IErrorLoggerService _errorLogger;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册