Vsvim: Using ReSharper rename keeps sets visual mode on

Created on 30 Oct 2019  Â·  7Comments  Â·  Source: VsVim/VsVim

Describe the bug
I have ReSharper and VsVim installed. When I use ReSharper to rename a variable VsVim is left in visual mode. I have to press escape several times to get it out of visual mode. Sometimes, I just have to hold the escape down for a couple of seconds to get VsVim out of visual mode.

To Reproduce
Steps to reproduce the behavior:

  1. Use ReSharper rename (ctrl-r, ctrl-r is the shortcut but the menu Refactor/Rename does the same thing) a variable.
  2. Type in the new name of the variable
  3. Hit enter when done

When I was just testing this, I hit escape 15 times and it was still in visual mode. After holding down the escape key for a while, VsVim exited visual mode.

Expected behavior
After renaming a variable, VsVim should not stay in visual mode.

Environment (please complete the following information):

  • Visual Studio version: 16.3.6 and 16.3.7
  • VsVim version: 2.8.324
  • Programming Language: C#
  • Check(Type 'x') any that are installed:

    • [x] ReSharper

    • [ ] Visual Assist

I have SuperCharger installed and thought that it could be the problem because of some stuff it does but I disabled it and the problem still happens.

Most helpful comment

I have this problem too, but as a workaround, you can exit visual mode with the v key instead when this happens.

All 7 comments

I have this problem too, but as a workaround, you can exit visual mode with the v key instead when this happens.

I have this issue too. I started seeing it after upgrading Resharper from 2019.2 to 2019.3.

I would like anyone who is actually experiencing this problem to do an experiment for me, if possible.

The experiment is to try turning off "Rename and Snippet Tracking". Yes I know that is contrary to the description given for the setting!

image

Anyway, I want to know how it affects the behavior. Thanks, kind soul!

I just tested this.

  1. I changed the setting to false.
  2. I used ReSharper rename (ctrl-r ctrl-r in my environment) to rename a
    variable
  3. ReSharper gave me a list of options to choose from.
  4. I selected an option
  5. The variable got renamed and it worked correctly. VxVim did not stay in
    visual mode.

Now the bad news.

  1. I repeated steps 1-3
  2. I started typing in a new name. I was just going to rename the variable
    to "fred"
  3. VsVim took over and when I hit fr VsVim moved the cursor to the next r
    in the current line of code
  4. When I hit e, VsVim moved to the end of the, now, current word
  5. When I hit d, VsVim deleted everything from the beginning of the word I
    wanted to rename to the new location of the cursor.

On Mon, Jan 6, 2020 at 2:03 PM Rick Sladkey notifications@github.com
wrote:

I would like anyone who is actually experiencing this problem to do an
experiment for me, if possible.

The experiment is to try turning off "Rename and Snippet Tracking". Yes I
know that is contrary to the description given for the setting!

[image: image]
https://user-images.githubusercontent.com/2680524/71848584-d92fab00-309d-11ea-86ab-1c05acba66de.png

Anyway, I want to know how it affects the behavior. Thanks, kind soul!

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/VsVim/VsVim/issues/2746?email_source=notifications&email_token=AAF6KIZ5JGCZXF2NPSNAWULQ4OMAVA5CNFSM4JGTUS4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIGYYJA#issuecomment-571313188,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAF6KI4FQXIKW26AT67AF5TQ4OMAVANCNFSM4JGTUS4A
.

@jnothstine Thanks for doing that test. I will keep thinking about it.

I just tried this out on 33c1fa4de80e23db2b9c41f3826cffa1b69bb60e (VS 16.4.4, ReSharper 2019.3.1). Same results as above, but I tried adding a breakpoint to this method that logs what the prev/next modes are:

https://github.com/VsVim/VsVim/blob/33c1fa4de80e23db2b9c41f3826cffa1b69bb60e/Src/VsVimShared/Implementation/ExternalEdit/ExternalEditMonitor.cs#L118

I copied out the contents of the output window after what seemed like significant actions to see if anything interesting shows up. I put the full results here: https://gist.github.com/dagood/cd82ff615041df2db8efca7ee5b08d55. (Probably some noise in there from focusing/unfocusing the experimental instance, sorry, not familiar with this output.)

One thing that looks weird to me is the switch from Normal => VisualCharacter => ExternalEdit after the initial refactor command, showing up as adjacent lines of the output:

...OnSwitchedMode(object, Vim.SwitchModeEventArgs): prev $Normal, next $VisualCharacter
...OnSwitchedMode(object, Vim.SwitchModeEventArgs): prev $VisualCharacter, next $ExternalEdit

Naively, this seems like it'd explain why completing the external edit causes VsVim to go to visual mode, since it was the prev mode before the tracked edit.

I actually downgraded ReSharper in my experimental instance from 2019.3.1 => 2019.2.4 to try to get a log to diff against, but it still repros for me! The strange-looking mode switch also still shows up. It's possible I need some more thorough refresh--I was just hoping to get something quickly to see if I was completely misguided, but not sure how to do that now.

Hitting v is a good enough workaround for me for now, thanks for that. 🙂

I've also noticed this issue for a few years now. Is this still in the process of being fixed, or is it just not realistically possible to resolve it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deevus picture deevus  Â·  4Comments

ogirginc picture ogirginc  Â·  6Comments

LariscusObscurus picture LariscusObscurus  Â·  4Comments

iamkarlson picture iamkarlson  Â·  7Comments

keithn picture keithn  Â·  4Comments