Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle dismissed rename tracking sessions #983

Merged
merged 1 commit into from
Mar 4, 2015

Conversation

dpoeschl
Copy link
Contributor

@dpoeschl dpoeschl commented Mar 3, 2015

Fixes #540 "Stale rename entries in the lightbulb menu"

Prior to this change, dismissed rename tracking sessions continued to
provide codefixes which would silently fail when invoked, without
completing the rename operation.

With this change, we now do the following when rename tracking is
manually dismissed:

  • Trigger the diagnostic service to reanalyze the document, thus
    removing the rename tracking diagnostic.
  • Stop providing a codefix when requested
  • Show a dialog if a cached codefix is invoked explaining that the
    rename was not performed.

Here are the there user scenarios:

  1. The user dismisses rename tracking
  • The lightbulb will continue to show in the margin, regardless of
    whether any codefix/refactoring is actually still available.
  1. The user expands the lightbulb without it ever having been expanded
    before.
  • In this case, we are queried for fixes and will not return any, so
    either the lightbulb will disappear or it will contain other relevant
    codefixes/refactorings at that position, excluding rename.
  1. The user expands the lightbulb after it was previously expanded.
  • Our fix was already cached, so we can only give a reasonable message
    when it is invoked.

Once #885 is fixed, we can instead implement IDiagnosticUpdateSource and
avoid forcing diagnostic reanalysis.

@dpoeschl
Copy link
Contributor Author

dpoeschl commented Mar 3, 2015

New PR because I cannot reopen #770. We want to eventually the implementation from reanalyzing diagnostics to implementing IDiagnosticUpdateSource, but that depends on #885 being completed. For the current milestone, let's proceed with this interim solution as it fixes certain cases and the rest of the time it avoids the confusion of committing the lightbulb item and having nothing happen.

@dpoeschl
Copy link
Contributor Author

dpoeschl commented Mar 3, 2015

Tagging reviewers: @balajikris was already looking at #770, and other potential reviewers include @Pilchie @basoundr @rchande @brettfo

@@ -1,13 +1,13 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other files in this PR keep the System directives at the top.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks Brett.

@Pilchie
Copy link
Member

Pilchie commented Mar 3, 2015

👍

Fixes dotnet#540 "Stale rename entries in the lightbulb menu"

Prior to this change, dismissed rename tracking sessions continued to
provide codefixes which would silently fail when invoked, without
completing the rename operation.

With this change, we now do the following when rename tracking is
manually dismissed:

- Trigger the diagnostic service to reanalyze the document, thus
removing the rename tracking diagnostic.
- Stop providing a codefix when requested
- Show a dialog if a cached codefix is invoked explaining that the
rename was not performed.

Here are the there user scenarios:

1. The user dismisses rename tracking

    - The lightbulb will continue to show in the margin, regardless of
whether any codefix/refactoring is actually still available.

2. The user expands the lightbulb without it ever having been expanded
before.

    - In this case, we are queried for fixes and will not return any, so
either the lightbulb will disappear or it will contain other relevant
codefixes/refactorings at that position, excluding rename.

3. The user expands the lightbulb after it was previously expanded.

    - Our fix was already cached, so we can only give a reasonable message
when it is invoked.

Once dotnet#885 is fixed, we can instead implement IDiagnosticUpdateSource and
avoid forcing diagnostic reanalysis.
@dpoeschl dpoeschl force-pushed the RenameTrackingEscapeCrash branch from a03d9d5 to 499a46f Compare March 4, 2015 00:26
@dpoeschl
Copy link
Contributor Author

dpoeschl commented Mar 4, 2015

@balajikris - can you take a look?

@balajikris
Copy link
Member

👍

dpoeschl added a commit that referenced this pull request Mar 4, 2015
Better handle dismissed rename tracking sessions
@dpoeschl dpoeschl merged commit 4ad1d41 into dotnet:master Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale rename entries in the lightbulb menu
5 participants