ViewFilter.HandleGoto Method
Processes the specified "go to" command.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Syntax
'宣言
Public Overridable Sub HandleGoto ( _
cmd As VSConstants.VSStd97CmdID _
)
public virtual void HandleGoto(
VSConstants.VSStd97CmdID cmd
)
Parameters
- cmd
Type: Microsoft.VisualStudio.VSConstants.VSStd97CmdID
[in] A value from the VSConstants.VSStd97CmdID enumeration specifying the type of "go to" command to execute. Expected values are GotoDefn, GotoDecl, and GotoRef.
Remarks
This method is called to handle a "go to" command. This method is responsible for obtaining the appropriate uniform resource identifier (URI) from the parser and then loading the requested document.
The base method calls the GetCaretPos method on the IVsTextView object passed to the ViewFilter constructor to obtain the current caret position. This position is then passed to the OnSyncGoto method on the Source object (obtained from the CodeWindowManager object in the ViewFilter constructor). If OnSyncGoto returned a valid URI then the URI is passed to the OpenDocument helper method in the VsShell class to open the document. If the document is successfully opened, the EnsureSpanVisible method is called followed by the SetSelection method to show the destination span in the loaded file.
In the default managed package framework implementation of the language service classes, this method is called from the HandlePreExec method.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.