コード例 #1
0
        static CSharpSuppressionFixProvider()
        {
            typeInfo = Type.GetType("Microsoft.CodeAnalysis.CSharp.CodeFixes.Suppression.CSharpSuppressionCodeFixProvider, Microsoft.CodeAnalysis.CSharp.Features", true);

            if (typeInfo == null)
            {
                LoggingService.LogError("CSharpSuppressionCodeFixProvider not found.");
            }

            canBeSuppressedOrUnsuppressedMethod = typeInfo.GetMethod("CanBeSuppressedOrUnsuppressed");
            if (canBeSuppressedOrUnsuppressedMethod == null)
            {
                LoggingService.LogError("CanBeSuppressedOrUnsuppressed not found.");
            }
            getFixAllProviderMethod = typeInfo.GetMethod("GetFixAllProvider");
            if (getFixAllProviderMethod == null)
            {
                LoggingService.LogError("GetFixAllProvider not found.");
            }

            getSuppressionsAsync1Method = typeInfo.GetMethod("GetSuppressionsAsync", new [] { typeof(Project), typeof(IEnumerable <Diagnostic>), typeof(CancellationToken) });
            if (getSuppressionsAsync1Method == null)
            {
                LoggingService.LogError("GetSuppressionsAsync1 not found.");
            }
            getSuppressionsAsync2Method = typeInfo.GetMethod("GetSuppressionsAsync", new [] { typeof(Document), typeof(TextSpan), typeof(IEnumerable <Diagnostic>), typeof(CancellationToken) });
            if (getSuppressionsAsync2Method == null)
            {
                LoggingService.LogError("GetSuppressionsAsync2 not found.");
            }
            Instance = new CSharpSuppressionFixProvider();
        }
コード例 #2
0
 public SuppressionFixerFixAllProviderInfo(
     FixAllProvider fixAllProvider,
     ISuppressionFixProvider suppressionFixer,
     IEnumerable <FixAllScope> supportedScopes)
     : base(fixAllProvider, supportedScopes)
 {
     this._canBeSuppressedOrTriaged = suppressionFixer.CanBeSuppressed;
 }
コード例 #3
0
 public SuppressionFixerFixAllProviderInfo(
     FixAllProvider fixAllProvider,
     ISuppressionFixProvider suppressionFixer,
     ImmutableArray <FixAllScope> supportedScopes)
     : base(fixAllProvider, supportedScopes)
 {
     _canBeSuppressedOrUnsuppressed = suppressionFixer.CanBeSuppressedOrUnsuppressed;
 }
コード例 #4
0
ファイル: FixAllProviderInfo.cs プロジェクト: Rickinio/roslyn
        /// <summary>
        /// Gets an optional <see cref="FixAllProviderInfo"/> for the given suppression fix provider.
        /// </summary>
        private static FixAllProviderInfo CreateWithSuppressionFixer(ISuppressionFixProvider provider)
        {
            var fixAllProvider = provider.GetFixAllProvider();
            if (fixAllProvider == null)
            {
                return null;
            }

            var scopes = fixAllProvider.GetSupportedFixAllScopes();
            if (scopes == null || scopes.IsEmpty())
            {
                return null;
            }

            return new SuppressionFixerFixAllProviderInfo(fixAllProvider, provider, scopes);
        }
コード例 #5
0
        /// <summary>
        /// Gets an optional <see cref="FixAllProviderInfo"/> for the given suppression fix provider.
        /// </summary>
        private static FixAllProviderInfo CreateWithSuppressionFixer(ISuppressionFixProvider provider)
        {
            var fixAllProvider = provider.GetFixAllProvider();

            if (fixAllProvider == null)
            {
                return(null);
            }

            var scopes = fixAllProvider.GetSupportedFixAllScopes();

            if (scopes == null || scopes.IsEmpty())
            {
                return(null);
            }

            return(new SuppressionFixerFixAllProviderInfo(fixAllProvider, provider, scopes));
        }
コード例 #6
0
		static CSharpSuppressionFixProvider ()
		{
			typeInfo = Type.GetType ("Microsoft.CodeAnalysis.CSharp.CodeFixes.Suppression.CSharpSuppressionCodeFixProvider, Microsoft.CodeAnalysis.CSharp.Features", true);

			if (typeInfo == null) 
				LoggingService.LogError ("CSharpSuppressionCodeFixProvider not found.");

			canBeSuppressedOrUnsuppressedMethod = typeInfo.GetMethod ("CanBeSuppressedOrUnsuppressed");
			if (canBeSuppressedOrUnsuppressedMethod == null)
				LoggingService.LogError ("CanBeSuppressedOrUnsuppressed not found.");
			getFixAllProviderMethod = typeInfo.GetMethod ("GetFixAllProvider");
			if (getFixAllProviderMethod == null)
				LoggingService.LogError ("GetFixAllProvider not found.");
				              
			getSuppressionsAsync1Method = typeInfo.GetMethod ("GetSuppressionsAsync", new [] { typeof(Project), typeof(IEnumerable<Diagnostic>), typeof(CancellationToken) });
			if (getSuppressionsAsync1Method == null)
				LoggingService.LogError ("GetSuppressionsAsync1 not found.");
			getSuppressionsAsync2Method = typeInfo.GetMethod ("GetSuppressionsAsync", new [] { typeof(Document), typeof(TextSpan), typeof(IEnumerable<Diagnostic>), typeof(CancellationToken) });
			if (getSuppressionsAsync2Method == null)
				LoggingService.LogError ("GetSuppressionsAsync2 not found.");
			Instance = new CSharpSuppressionFixProvider ();
		}
コード例 #7
0
 public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, IEnumerable<string> diagnosticIds)
 {
     _suppressionFixProvider = suppressionFixProvider;
     _originalDiagnosticIds = diagnosticIds.Distinct().ToImmutableArray();
 }
コード例 #8
0
ファイル: FixAllProviderInfo.cs プロジェクト: Rickinio/roslyn
 public SuppressionFixerFixAllProviderInfo(
     FixAllProvider fixAllProvider,
     ISuppressionFixProvider suppressionFixer,
     IEnumerable<FixAllScope> supportedScopes)
     : base(fixAllProvider, supportedScopes)
 {
     _canBeSuppressedOrUnsuppressed = suppressionFixer.CanBeSuppressedOrUnsuppressed;
 }
コード例 #9
0
 public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, ImmutableArray<Diagnostic> originalDiagnostics)
 {
     _suppressionFixProvider = suppressionFixProvider;
     _originalDiagnosticIds = originalDiagnostics.Select(d => d.Id).Distinct().ToImmutableArray();
 }
コード例 #10
0
 public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, ImmutableArray <Diagnostic> originalDiagnostics)
 {
     _suppressionFixProvider = suppressionFixProvider;
     _originalDiagnosticIds  = originalDiagnostics.Select(d => d.Id).Distinct().ToImmutableArray();
 }
コード例 #11
0
 public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, IEnumerable <string> diagnosticIds)
 {
     _suppressionFixProvider = suppressionFixProvider;
     _originalDiagnosticIds  = diagnosticIds.Distinct().ToImmutableArray();
 }