-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Go To Definition - Native command.
- Loading branch information
Showing
6 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using Microsoft.VisualStudio; | ||
using Microsoft.VisualStudio.OLE.Interop; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
using Microsoft.VisualStudio.TextManager.Interop; | ||
|
||
namespace SLaks.Ref12.Commands { | ||
class GoToDefintionNativeCommand : CommandTargetBase<Ref12Command> { | ||
public GoToDefintionNativeCommand(IVsTextView adapter, IWpfTextView textView) : base(adapter, textView, Ref12Command.GoToDefinitionNative) { | ||
} | ||
protected override bool Execute(Ref12Command commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { | ||
NextTarget.Execute(VSConstants.VSStd97CmdID.GotoDefn, nCmdexecopt, pvaIn, pvaOut); | ||
return true; | ||
} | ||
|
||
protected override bool IsEnabled() { | ||
// We override QueryStatus directly to pass the raw arguments | ||
// to the inner command, so this method will never be called. | ||
throw new NotImplementedException(); | ||
} | ||
public override int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { | ||
if (pguidCmdGroup != CommandGroup || cCmds != 1 || prgCmds[0].cmdID != CommandIds[0]) | ||
return NextTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText); | ||
var innerGuid = typeof(VSConstants.VSStd97CmdID).GUID; | ||
var innerCommands = new[] { new OLECMD { | ||
cmdID = (uint)VSConstants.VSStd97CmdID.GotoDefn, | ||
cmdf=prgCmds[0].cmdf | ||
} }; | ||
int result = NextTarget.QueryStatus(ref innerGuid, 1, innerCommands, pCmdText); | ||
prgCmds[0].cmdf = innerCommands[0].cmdf; | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters