int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType) { if (index >= (uint)_children.Count) { throw new ArgumentOutOfRangeException("index"); } _children[(int)index].GotoSource(SrcType); return(VSConstants.S_OK); }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (VSOBJGOTOSRCTYPE.GS_REFERENCE == gotoType) { return; } base.OpenSourceFile(); }
int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE SrcType, out int pfOK) { if (index >= (uint)_children.Count) { throw new ArgumentOutOfRangeException("index"); } pfOK = _children[(int)index].CanGoToSource ? 1 : 0; return(VSConstants.S_OK); }
protected override int GoToSource(uint index, VSOBJGOTOSRCTYPE srcType) { if (index >= _items.Count) { return(VSConstants.E_INVALIDARG); } var item = _items[(int)index]; return(item.GoToSource()); }
protected override bool CanGoToSource(uint index, VSOBJGOTOSRCTYPE srcType) { if (srcType == VSOBJGOTOSRCTYPE.GS_DEFINITION) { if (GetListItem(index) is SymbolListItem symbolItem) { return(symbolItem.SupportsGoToDefinition); } } return(false); }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (gotoType == VSOBJGOTOSRCTYPE.GS_REFERENCE) { return; } // if (this.member != null) { this.member.OpenEditor(); } }
int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType) { SQObjectLibraryNode node; if (GetChild(index, out node)) { SQVSUtils.OpenDocumentInNewWindow(node._declaration.Url, node._filenode.ProjectMgr.Site, node._declaration.Span.iStartLine); return(VSConstants.S_OK); } else { return(VSConstants.S_FALSE); } }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (gotoType == VSOBJGOTOSRCTYPE.GS_REFERENCE) { return; } // if (this.CanGoToSource && this.editorInfo != null) { // Need to retrieve the Project, then the File... var file = XSolution.FindFile(editorInfo.FileName); XSettings.OpenDocument(file.FullPath, editorInfo.Line, editorInfo.Column, true); } }
/// <summary> /// Returns a flag indicating if navigation to the given list item's source is supported. /// </summary> /// <param name="index"></param> /// <param name="SrcType"></param> /// <param name="pfOK"></param> /// <returns></returns> int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE SrcType, out int pfOK) { //if (ListToReference != null && index == ) { // ListToReference.CanGoToSource(index, SrcType, out pfOK); // return VSConstants.S_OK; //} //Logger.Log("ResultList.CanGoToSource"); if (index >= (uint)children.Count) { throw new ArgumentOutOfRangeException("index"); } pfOK = children[(int)index].CanGoToSource ? 1 : 0; return(VSConstants.S_OK); }
/// <summary> /// Navigates to the source for the given list item. /// </summary> /// <param name="index"></param> /// <param name="SrcType"></param> /// <returns></returns> int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType) { if (index >= (uint)children.Count) { throw new ArgumentOutOfRangeException("index"); } if (children[(int)index].ListToReference != null) { children[(int)index].ListToReference.GoToSource(0, SrcType); } else { children[(int)index].GotoSource(SrcType); } return(VSConstants.S_OK); }
int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE SrcType, out int pfOK) { //pfOK = CanGoToSource ? 1 : 0; //return VSConstants.S_OK; SQObjectLibraryNode node; if (GetChild(index, out node) && node._declaration != null) { pfOK = node.CanGoToSource ? 1 : 0; return(VSConstants.S_OK); } else { pfOK = 0; return(VSConstants.S_FALSE); } }
protected override bool CanGoToSource(uint index, VSOBJGOTOSRCTYPE srcType) { var item = _items[(int)index]; switch (srcType) { case VSOBJGOTOSRCTYPE.GS_ANY: return(true); case VSOBJGOTOSRCTYPE.GS_DEFINITION: return(item.GlyphIndex != Glyph.Reference.GetGlyphIndex()); case VSOBJGOTOSRCTYPE.GS_REFERENCE: return(item.GlyphIndex == Glyph.Reference.GetGlyphIndex()); } return(false); }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (gotoType == VSOBJGOTOSRCTYPE.GS_REFERENCE) { return; } // if (this.CanGoToSource && this.editorInfo != null) { // Need to retrieve the Project, then the File... //this.member.OpenEditor(); var file = XSolution.FindFile(editorInfo.FileName); var project = file.Project; var node = project.ProjectNode; node.OpenElement(file.FullPath, editorInfo.Line, editorInfo.Column); } }
protected override bool CanGoToSource(uint index, VSOBJGOTOSRCTYPE srcType) { var item = _items[(int)index]; switch (srcType) { case VSOBJGOTOSRCTYPE.GS_ANY: return(true); case VSOBJGOTOSRCTYPE.GS_DEFINITION: return(item.CanGoToDefinition()); case VSOBJGOTOSRCTYPE.GS_REFERENCE: return(item.CanGoToReference()); } return(false); }
protected override int GoToSource(uint index, VSOBJGOTOSRCTYPE srcType) { if (srcType == VSOBJGOTOSRCTYPE.GS_DEFINITION) { if (GetListItem(index) is SymbolListItem symbolItem && symbolItem.SupportsGoToDefinition) { var project = this.LibraryManager.Workspace.CurrentSolution.GetProject(symbolItem.ProjectId); var compilation = project.GetCompilationAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var symbol = symbolItem.ResolveSymbol(compilation); if (this.LibraryManager.Workspace.TryGoToDefinition(symbol, project, CancellationToken.None)) { return(VSConstants.S_OK); } else { return(VSConstants.S_FALSE); } } } return(VSConstants.E_FAIL); }
public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) { _locationInfo.GotoSource(); }
public virtual void GotoSource(VSOBJGOTOSRCTYPE SrcType) { }
protected virtual void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // Do nothing. }
IEnumerable<INavigateToTarget> ITvlIntellisenseController.GoToSourceImpl(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint) { Contract.Requires<ArgumentNullException>(triggerPoint != null, "triggerPoint"); Contract.Ensures(Contract.Result<IEnumerable<INavigateToTarget>>() != null); throw new NotImplementedException(); }
void ITvlIntellisenseController.GoToSource(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint) { Contract.Requires<ArgumentNullException>(triggerPoint != null, "triggerPoint"); throw new NotImplementedException(); }
int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE SrcType, out int pfOK) { if (index >= (uint)children.Count) { throw new ArgumentOutOfRangeException("index"); } pfOK = children[(int)index].CanGoToSource ? 1 : 0; return VSConstants.S_OK; }
public override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (VSOBJGOTOSRCTYPE.GS_REFERENCE == gotoType) { return; } foreach (var completion in _value.Values) { foreach (var location in completion.locations) { if (File.Exists(location.file)) { PythonToolsPackage.NavigateTo( Site, location.file, Guid.Empty, location.line - 1, location.column - 1 ); break; } } } }
IEnumerable <INavigateToTarget> ITvlIntellisenseController.GoToSourceImpl(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint) { Contract.Requires <ArgumentNullException>(triggerPoint != null, "triggerPoint"); Contract.Ensures(Contract.Result <IEnumerable <INavigateToTarget> >() != null); throw new NotImplementedException(); }
int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType) { if (index >= (uint)_children.Count) throw new ArgumentOutOfRangeException("index"); _children[(int)index].GotoSource(SrcType); return VSConstants.S_OK; }
public virtual void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // Do nothing. }
protected abstract int GoToSource(uint index, VSOBJGOTOSRCTYPE srcType);
public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) { _locationInfo.GotoSource(_serviceProvider); }
public void GotoSource(VSOBJGOTOSRCTYPE SrcType) { }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (VSOBJGOTOSRCTYPE.GS_REFERENCE == gotoType) { return; } // There is no difference between definition and declaration, so here we // don't check for the other flags. IVsWindowFrame frame = null; IntPtr documentData = FindDocDataFromRDT(); try { // Now we can try to open the editor. We assume that the owner hierarchy is // a project and we want to use its OpenItem method. IVsProject3 project = ownerHierarchy as IVsProject3; if (null == project) { return; } Guid viewGuid = VSConstants.LOGVIEWID_Code; ErrorHandler.ThrowOnFailure(project.OpenItem(fileId, ref viewGuid, documentData, out frame)); } finally { if (IntPtr.Zero != documentData) { Marshal.Release(documentData); documentData = IntPtr.Zero; } } // Make sure that the document window is visible. ErrorHandler.ThrowOnFailure(frame.Show()); // Get the code window from the window frame. object docView; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView)); IVsCodeWindow codeWindow = docView as IVsCodeWindow; if (null == codeWindow) { object docData; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out docData)); codeWindow = docData as IVsCodeWindow; if (null == codeWindow) { return; } } // Get the primary view from the code window. IVsTextView textView; ErrorHandler.ThrowOnFailure(codeWindow.GetPrimaryView(out textView)); // Set the cursor at the beginning of the declaration. ErrorHandler.ThrowOnFailure(textView.SetCaretPos(sourceSpan.iStartLine, sourceSpan.iStartIndex)); // Make sure that the text is visible. TextSpan visibleSpan = new TextSpan(); visibleSpan.iStartLine = sourceSpan.iStartLine; visibleSpan.iStartIndex = sourceSpan.iStartIndex; visibleSpan.iEndLine = sourceSpan.iStartLine; visibleSpan.iEndIndex = sourceSpan.iStartIndex + 1; ErrorHandler.ThrowOnFailure(textView.EnsureSpanVisible(visibleSpan)); }
/// <summary> /// Navigates to the source for the given list item. /// </summary> /// <param name="index"></param> /// <param name="SrcType"></param> /// <returns></returns> int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType) { if (index >= (uint)children.Count) { throw new ArgumentOutOfRangeException("index"); } if (children[(int)index].ListToReference != null) children[(int)index].ListToReference.GoToSource(0, SrcType); else children[(int)index].GotoSource(SrcType); return VSConstants.S_OK; }
int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE srcType, out int pfOK) { pfOK = CanGoToSource(index, srcType) ? 1 : 0; return(VSConstants.S_OK); }
/// <summary> /// Returns a flag indicating if navigation to the given list item's source is supported. /// </summary> /// <param name="index"></param> /// <param name="SrcType"></param> /// <param name="pfOK"></param> /// <returns></returns> int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE SrcType, out int pfOK) { //if (ListToReference != null && index == ) { // ListToReference.CanGoToSource(index, SrcType, out pfOK); // return VSConstants.S_OK; //} //Logger.Log("ResultList.CanGoToSource"); if (index >= (uint)children.Count) { throw new ArgumentOutOfRangeException("index"); } pfOK = children[(int)index].CanGoToSource ? 1 : 0; return VSConstants.S_OK; }
protected override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // do nothing - not supported for namespaces }
public override void GotoSource(VSOBJGOTOSRCTYPE gotoType) { // We do not support the "Goto Reference" if (VSOBJGOTOSRCTYPE.GS_REFERENCE == gotoType) { return; } // There is no difference between definition and declaration, so here we // don't check for the other flags. IVsWindowFrame frame = null; IntPtr documentData = FindDocDataFromRDT(); try { // Now we can try to open the editor. We assume that the owner hierarchy is // a project and we want to use its OpenItem method. IVsProject3 project = _ownerHierarchy as IVsProject3; if (null == project) { return; } Guid viewGuid = VSConstants.LOGVIEWID_Code; ErrorHandler.ThrowOnFailure(project.OpenItem(_fileId, ref viewGuid, documentData, out frame)); } finally { if (IntPtr.Zero != documentData) { Marshal.Release(documentData); documentData = IntPtr.Zero; } } // Make sure that the document window is visible. ErrorHandler.ThrowOnFailure(frame.Show()); // Get the code window from the window frame. object docView; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView)); IVsCodeWindow codeWindow = docView as IVsCodeWindow; if (null == codeWindow) { object docData; ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out docData)); codeWindow = docData as IVsCodeWindow; if (null == codeWindow) { return; } } // Get the primary view from the code window. IVsTextView textView; ErrorHandler.ThrowOnFailure(codeWindow.GetPrimaryView(out textView)); // Set the cursor at the beginning of the declaration. ErrorHandler.ThrowOnFailure(textView.SetCaretPos(_sourceSpan.iStartLine, _sourceSpan.iStartIndex)); // Make sure that the text is visible. TextSpan visibleSpan = new TextSpan(); visibleSpan.iStartLine = _sourceSpan.iStartLine; visibleSpan.iStartIndex = _sourceSpan.iStartIndex; visibleSpan.iEndLine = _sourceSpan.iStartLine; visibleSpan.iEndIndex = _sourceSpan.iStartIndex + 1; ErrorHandler.ThrowOnFailure(textView.EnsureSpanVisible(visibleSpan)); }
void ITvlIntellisenseController.GoToSource(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint) { Contract.Requires <ArgumentNullException>(triggerPoint != null, "triggerPoint"); throw new NotImplementedException(); }