提交 07a6e00b 编写于 作者: S shyamn

1. The 'preview changes' feature in the light bulb preview pane had a bug...

1. The 'preview changes' feature in the light bulb preview pane had a bug which meant that it was only applying ApplyChangesOperations - other operations (such as opening and navigating to a document added as part of a fix etc.) were being skipped when the user clicked Apply in the preview dialog. This fix makes sure that we don't skip any operations and that the code fix is applied the same way regardless of whether the user clicks on the light bulb menu or the Apply button in the preview dialog.

2. Additionally, this change also disables check boxes in the preview changes dialog so that it is impossible select / deselect portions of a fix and apply the fix partially. Applying a partial fix can break assumptions in subsequent operations (for example, user could deselect changes to add a document that a subsequent OpenDocumentOperation is going to open and thereby cause this operation to fail).

3. This change also changes the order of suppression fixes so that the 'global' suppression fix (that adds SuppressMessageAttribute in a separate file) is always last in the list of suppression fixes. After this change the suppression menu will read as follows with the (separate file) fix showing up at the end instead of in the middle.

     Suppress CA1234 -> this instance
                                         with SuppressMessageAttribute
                                         with SuppressMessageAttribute (in separate file)

4. Also augment doc comment for batch fix all provider to clarify that only ApplyChangesOperations in the constituent fix occurances are batched and that other operations are ignored. (changeset 1353192)
上级 d7a497cb
// Copyright (c) Microsoft Open Technologies, Inc. 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.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeFixes
{
......@@ -24,6 +16,11 @@ public static class WellKnownFixAllProviders
/// This fixer supports fixes for the following fix all scopes:
/// <see cref="FixAllScope.Document"/>, <see cref="FixAllScope.Project"/> and <see cref="FixAllScope.Solution"/>.
/// </summary>
/// <remarks>
/// The batch fix all provider only batches operations (i.e. <see cref="CodeActionOperation"/>) of type
/// <see cref="ApplyChangesOperation"/> present within the individual diagnostic fixes. Other types of
/// operations present within these fixes are ignored.
/// </remarks>
public static readonly FixAllProvider BatchFixer = BatchFixAllProvider.Instance;
/// <summary>
......@@ -35,4 +32,4 @@ public static class WellKnownFixAllProviders
/// </summary>
internal static readonly FixAllProvider BatchSimplificationFixer = BatchSimplificationFixAllProvider.Instance;
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册