1

Topic: Update to Resharper 2019.1.1 Consumes ESC

Still trying to figure out all conditions where this occurs, but after the latest update to ReSharper, the ESC key is being consumed before VIEmu gets to see it.  When trying to go from Insert mode to Normal mode, I am, in some cases, having to hit ESC two to three additional times to return to Normal mode.  It seems to be situations where ReSharper has offered autocompletion options.  Not quite sure what the difference is where it needs two ESC vs three.  I temporarily suspended ReSharper and ViEmu goes back to expected behavior.  That and it started after the latest update applied, so pretty sure it's a change to ReSharper.  I'm going to send them a note too, but figure they'll point me back here.

VS2017 Enterprise 15.9.11
ReSharper 2019.1.1 latest release version
ViEmu 3.9.1

2

Re: Update to Resharper 2019.1.1 Consumes ESC

I tried to downgrade to ReSharper 2019.1, but it did not resolve issue.  Based on 2019.1 -> 2019.1.1 release dates being so close, I might have updated from 2018.3.4, so might be a change in the 2019 version rather than .1 -> .1.1

3

Re: Update to Resharper 2019.1.1 Consumes ESC

Hello David, I plan to review compatibility with 3rd party add-ins in the coming weeks, hopefully I will be able to provide a new ViEmu version soon addressing this. Thanks for your patience -- Jon

4

Re: Update to Resharper 2019.1.1 Consumes ESC

Thanks!

5

Re: Update to Resharper 2019.1.1 Consumes ESC

After a ton of hours debugging and logging and trying to fully understand VS input processing in the presence of R# (impossible task, I would say, but I did get closer....), I have an idea that may help solving this.

Some background: ViEmu never gets access to the KeyDown event for the ESC key, mind you, only the ECMD_CANCEL / Edit.SelectionCancel command, which is the result of ESC KeyDown in stock VS, but when R# autocompletion is there, ViEmu doesn't even get to see that, that's why insert mode is not exited. ViEmu used to still get the QueryStatus call for that command, which allowed me to fix that in older versions of VS+R# combination, simulating ESC just on the Query for the command (which comes before executing it). But now, for some reason, I got no QueryStatus for ECMD_CANCEL at all any more when R# autocompletion is there.

So, my current possibly working idea for a fix would involve using the KeyUp event for the ESC key, which ViEmu does get! And exiting insert mode (or maybe doing whatever ESC is supposed to do). It seems a bit weird and potentially troublesome, but it may work,, and I'm thinking about having this active in some sort of setting. Best would be to have it always active and making sure it never causes trouble, but I will have to verify that throughly before changing the behavior of ViEmu when R# is not present.

I will post here again as soon as I have a new idea or a new version ready.

Thanks for your patience!

  -- Jon

6

Re: Update to Resharper 2019.1.1 Consumes ESC

Please, fix this as soon as you possibly can!! This is driving me up the wall!! I'm already developing the habit of hitting esc three times but that's not always enough. I just got used to have Resharper active before we upgraded to vs2019 and now I seem to have to choose between viemu or resharper. (No choice really, resharper will have to go if this can't be resolved, but I really don't want to have to do that now).

7

Re: Update to Resharper 2019.1.1 Consumes ESC

Jon,

Any ETA on an update to correct this?

8

Re: Update to Resharper 2019.1.1 Consumes ESC

Stephen, apologies for not responding earlier. You can now go to http://www.viemu.com and download ViEmu/VS version 3.10.0 for VS2015, 2017 and 2019, which should fix the issue. It is also upgraded to the VS "async package" interface so that VS won't complain any more about deprecated synchronous loading from ViEmu.

Regards,

-- Jon

9

Re: Update to Resharper 2019.1.1 Consumes ESC

Yeah! Thanks, Jon. Just downloaded and its looking good. Now I just have to unlearn hitting ESC multiple times!

10

Re: Update to Resharper 2019.1.1 Consumes ESC

FYI, it doesn't seem to work in all situations.  I've uninstalled Resharper and reinstalled Viemu on a Visual Studio 2017 instance and can't get out of insert mode using ESC.  I had a working install of both Resharper and Viemu yesterday but unfortunately tried to get 2019 working with latest versions of both and it's broken everything.

Let me know if you need any information. 

Visual Studio Enterprise 20197
Version 15.9.17
Viemu: 3.10
Resharper Ultimate 2019.2 (currently uninstalled with no luck)

11

Re: Update to Resharper 2019.1.1 Consumes ESC

Oh, sad to hear, but thanks for letting me know. I will definitely look into this. Hopefully it is not too difficult to address. Does the combination Ctrl-[ work to exit insert mode in that case?

12

Re: Update to Resharper 2019.1.1 Consumes ESC

Hi Jon,

Sorry for the late reply, holidays got in the way.

Oddly, it's now working for code files though it still ignores files like web.config.  I upgraded both VS and Resharper.  I then reset all key bindings to Visual C#2005 in Visual Studio, then reapplied Resharper keybindings and then reapplied Viemu key bindings. 

Not sure why *.config files don't respect ESC but for now, I can make this work. 

Thanks,
Brett Bim

13

Re: Update to Resharper 2019.1.1 Consumes ESC

Brett, thanks for updating me on this. VS text files have a 'language service' assigned on load based on their extension, which provides syntax highlighting and Intellisense among other things, but which more or less free reign to do what it wants. There are many stock language services installed with base VS (for C, C++, C#, VB, etc...), and other extensions can install extra language services. As far as I know, there can only be one language service loading for a given editor window.

Files with a ".config" extension are probably triggering the load of some specific language service, and that language service is interfering with Esc. Because, what extension/add-in/language-service/random package does not want to do something unique with Backspace, Enter or Esc and is not thinking about the potential impact on other extensions? Pardon my passive aggressive rant, just trying to drive the point across.

You might have some luck if you're not using anything special from the .config language service and you can configure things so that the language service is not loaded. This documentation page shows how language services are configured in VS:

  https://docs.microsoft.com/en-us/visual … ew=vs-2019

Apart from a language service, the issue may be caused by a MEF extension (the newer way to intercept and disrupt all kinds of things, which ViEmu of course uses to provide vi/vim bindings after VS2010). When the issue is file-extension-specific, it is usually about the language service, but it may not be the case. If it is a MEF issue, then all bets are off, you may just need to try enabling and disabling every extension in your installation of VS, since the MEF tree build and data/event distribution in MEF is obscure, poorly documented, undebuggable, and prone to all sorts of issues (as you saw yourself).

I will have a look at it at some point though, to see if I can find what the issue may be.

Cheers,

  -- Jon