1

Re: CodeRush/DXCore issues

I am right on the edge of purchasing ViEmu but I would need these issues to be fixed first:

Major issue:
Per the compatibility page I installed the plug-in for DXCore that makes ViEmu switch to Insert mode when CodeRush enters linked edit mode.  This works properly, however, u for undo crashes Visual Studio 2008 when the plug-in is installed and a space is used to exit a field.  This may be because the plug-in appears to be written for DXCore 1.1(guessing based on install instructions) and I have the latest CodeRush+Refactor and DXCore(2.5.10).

An easy way to re-create this crash is to use the Safe Rename refactoring, type the new name and hit space instead of enter to finish.  Then hit Escape to exit Insert mode and hit u to undo.

Minor issue:
ViEmu does not work properly with CodeRush when CodeRush's "Smart Parentheses" feature is turned on.  If you close a parenthesis on a method call and Smart Parentheses kicks in, ViEmu exits Insert mode.  Also, if you hit semi-colon inside the parentheses it will exit Insert mode as well.  I could probably live without this feature in CodeRush but I would rather see it fixed if possible.

2

Re: CodeRush/DXCore issues

If you use a "Rename" type refactoring, the plug-in for DXCore does not remember whether you were in Insert or Normal mode before you started.  I think it should automatically switch back when the user finishes the refactoring, if this is possible.  Saves a keystroke.  Right now, ViEmu stays in Insert and you have to hit Escape to move along.

Last edited by TedMilker (2007-12-16 04:10:06)

3

Re: CodeRush/DXCore issues

Hi Ted, I'll try to address these issues. Indeed, the Coderush-compatibility DXCore DLL is for DXCore 1.1 or so. I'll investigate and post back here with the results.

4

Re: CodeRush/DXCore issues

Im trying to write my own plugin for DXCore and CodeRush to integrate with vi emu

I know that there is such an iterface fo ViEmu service

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("AF8F75A1-A458-4F1F-BFAE-3B1B0E27D97A")]
internal interface IViEmu
{
    void EnterInsertMode();
}

Is there any method for entering normal mode and some property or method which tells what is actual mode ?

5

Re: CodeRush/DXCore issues

Hi Rod,

There isn't, but I can add them very easily to the ViEmu service. I'll prepare it tomorrow and drop you a line.

Regards,

  Jon

6

Re: CodeRush/DXCore issues

Hi Rod,

I've implemented a new service and built and uploaded 2.1.19:

  http://www.viemu.com/ViEmuVS-2.1.19.msi

You need to manually uninstall the previous version before installing this one. This is the spec of the new service:

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("C93926D3-533A-47BD-A085-DDA86F19D8EC")]
internal interface IViEmuService2
{
    void EnterInsertMode();
    void EnterNormalMode();
    int   GetViMode();
};

Actually - internally - these are the C++ interfaces of the functions - I'm letting you know in case the last one is not 'converted' to a C#-interface as described above:

MIDL_INTERFACE("C93926D3-533A-47bd-A085-DDA86F19D8EC")
IViEmuService2 : public IUnknown
{
  public:
    virtual HRESULT STDMETHODCALLTYPE EnterInsertMode( ) = 0;
    virtual HRESULT STDMETHODCALLTYPE EnterNormalMode () = 0;
    virtual HRESULT STDMETHODCALLTYPE GetViMode (long *pResult) = 0;
};

The ServiceID is the same, only the IID changes to the new GUID shown above.

Let me know if it works fine for you or in case you need anything else.

Regards,

  Jon

7

Re: CodeRush/DXCore issues

Thx Jon

This is my first contribute....

http://rod.neostrada.pl/CodeRush/CR_ViEmuHelper.zip

It is a solution for "Smart Parentheses" problem.


It can be easly dissassembled in reflector to see how it is done.

Last edited by rod (2007-12-25 23:06:09)

8

Re: CodeRush/DXCore issues

Hi Rod,

Thank you very much! I will have a look at this, as I review compatibility issues over the next few days. I want to fix the crash-bug described above asap, most likely over the next couple of days.

I will try to prepare a solution with everything together and post it on the compatibility page (and here).

Best regards and happy holidays!

  Jon

9

Re: CodeRush/DXCore issues

Hi Ted,

I've finally been able to reproduce the problem. The 'compatibility plugin' needn't be installed for the crash to occur. It seems the problem is due to the mentioned refactoring using a 'multi-file linked undo' undo-grouping element. What ViEmu does in order to reproduce vi/vim-like undo grouping (ie, a 'c' command should be undone fully, both the typing and the erasing) works fine regularly, but causes some trouble in this case. Now that I've reproduced it, I'm looking for a workaround (hopefully something less disciplinary than disabling viemu-undo-grouping when refactor! is present). I'll post about my results here.

[You can actually notice some of the weird behavior from Refactor if you watch the '*' changed-marker next to the file name, when you invoke the refactoring, the file is changed but the '*' does not appear. The actual crash happens in an internal VS function called 'SavePendingTextBuffers' which sounds suspect of doing ugly stuff.]

Regards,

  Jon

10

Re: CodeRush/DXCore issues

I'm glad I would help. Anyway ... there are also some issues with selection in CodeRush but I will have to figure them out precisely.

It would be nice if you coluld add to an interface EnterVisualMode() method and possibility that GetViMode() method could also return if ViEmu is in visual mode.

Last edited by rod (2007-12-27 15:11:47)

11

Re: CodeRush/DXCore issues

Hi Rod,

I'm working in Coderush compatibility full time right now. About 10 hours yesterday tracing through VS code *in assembly language* and trying to find a work-around for the crash problem. I'm now testing the possiblity of fixing it somehow in the CR compatibility plug-in (not the best solution, I prefer out-of-the-box compatibility measures, but i's proving to be impossible). In any case, I want to leave this area totally clear for the the short-term future, as many customers will be upgrading to vs2k8 and the latest version of Coderush in the coming months.

I will make sure ViEmu exposes all that functionality correctly, thanks for the suggestion.

Best regards & happy new year!

- Jon

12

Re: CodeRush/DXCore issues

Hello Ted and everyone else,

Apologies for taking some time to solve this - it's been a pretty stressing few days (!) of tracing through Visual Studio to understand the problem and find the workaround.

I have built & uploaded a new version of ViEmu/VS which uses a different method for 'undo' and thus works around the crash that arises with Coderush's 'Safe rename' (and possibly other refactorings). I also detected that this not only happened with VS 2008, but also with VS 2005.

Here is the link to download it:

  http://www.viemu.com/ViEmuVS-2.1.20.msi

You need to manually uninstall the previous version of ViEmu before installing this one.

For the 'smart parentheses' problem, please let me know if the plug-in kindly provided by Rod above is enough. In any case, I will be preparing a new version of the plugin in the official ViEmu compatibility page in the next few days.

Thanks, best regards, and happy new year everyone!!

  Jon

---
Edit: I described more details about this on the ViEmu blog:

  http://www.viemu.com/blog/2007/12/29/viemuvs-and-coderush-compatibility-week/

13

Re: CodeRush/DXCore issues

I've noticed that my plugin which should fix "Smart Parentheses" sometimes works and sometimes not. This is because GetViMode() not alway returns proper mode.

14

Re: CodeRush/DXCore issues

Hi Rod,

I will try to debug it. I used reflector to see what your plug-in is doing, and reimplemented it myself (still haven't released it). I think it might be something else, as the GetViMode() funcion is absolutely dumb ("*pDest = m_ViMode; return S_OK;"). I think it might have to do with the state changes your technique is remembering, maybe coupled with a less-than-reliable tracking of Coderush or VS actions: oftentimes, for example when autocompleting using Intellisense, the VS language service does actions in very weird way, such as erasing the partial word, inserting a newline, inserting the autocompleted word and then removing the newline. That kind of thing, all actions with their associated event triggers, can confuse even the most careful event-dependent logic.

If you have a description of when it fails, I may be able to understand what's happening better.

Best regards,

  Jon