Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

SDK Package: Command Filter doesn't catch 'Edit.CompleteWord' command

$
0
0

I develop a Visual studio extension where I need to process 'Edit.CompleteWord' command in a custom way. In my code, I have 'MyCommandFilter' which I add to the VS filter chain using 'AddCommandFilter'.

The 'MyCommandFilter' looks like this:

public class MyCommandFilter : IOleCommandTarget
{
    public IOleCommandTarget Next { get; set; }

    public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
    {
        if (pguidCmdGroup == VsMenus.guidStandardCommandSet2K &&  nCmdID == (uint)VSConstants.VSStd2KCmdID.COMPLETEWORD) {
        {
            // Do something
        }
        return Next.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
    }

    public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
    {
        if (pguidCmdGroup == VsMenus.guidStandardCommandSet2K && prgCmds[0].cmdID == (uint)VSConstants.VSStd2KCmdID.COMPLETEWORD) {
          prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED;
          prgCmds[0].cmdf |= (uint)OLECMDF.OLECMDF_ENABLED;
          return VSConstants.S_OK;
        }
        return Next.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
    }
}
Command 'COMPLETEWORD' does not arrive to the 'MyCommandFilter'. Apparently, not all commands are arriving to 'MyCommandFilter'.

How can I catch those commands? Maybe Visual Studio has another mechanism that will help me to catch those commands or to catch pressed hotkey combinations?

Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>