public void AugmentPeekSession(IPeekSession session, IList <IPeekableItem> peekableItems) { var triggerPoint = session.GetTriggerPoint(_textBuffer.CurrentSnapshot); if (!triggerPoint.HasValue) { return; } var itemName = session.TextView.GetIdentifierUnderCaret(out Span span); if (!string.IsNullOrEmpty(itemName)) { var textDocument = _textBuffer.GetTextDocument(); var document = _textBuffer.GetEditorDocument <IREditorDocument>(); var definitionNode = document?.EditorTree.AstRoot.FindItemDefinition(triggerPoint.Value, itemName); if (definitionNode != null) { peekableItems.Add(new UserDefinedPeekItem(textDocument.FilePath, definitionNode, itemName, _peekResultFactory, _services)); } else { // Not found. Try internal functions var item = new InternalFunctionPeekItem(textDocument.FilePath, span, itemName, _peekResultFactory, _services); peekableItems.Add(item); } } }
public InternalFunctionPeekResultSource(string sourceFileName, Span sourceSpan, string functionName, InternalFunctionPeekItem peekItem, ICoreShell shell) { _peekItem = peekItem; _shell = shell; // Start asynchronous function fetching so by the time FindResults // is called the task may be already completed or close to that. LookupTask = FindFunctionAsync(sourceFileName, sourceSpan, functionName); }
public InternalFunctionPeekResultSource(string sourceFileName, Span sourceSpan, string functionName, InternalFunctionPeekItem peekItem) { _peekItem = peekItem; // Start asynchronous function fetching so by the time FindResults // is called the task may be already completed or close to that. LookupTask = FindFunctionAsync(sourceFileName, sourceSpan, functionName); }
public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekableItems) { var triggerPoint = session.GetTriggerPoint(_textBuffer.CurrentSnapshot); if (!triggerPoint.HasValue) return; Span span; string itemName = session.TextView.GetIdentifierUnderCaret(out span); if (!string.IsNullOrEmpty(itemName)) { ITextDocument textDocument = _textBuffer.GetTextDocument(); var document = REditorDocument.TryFromTextBuffer(_textBuffer); var definitionNode = document?.EditorTree.AstRoot.FindItemDefinition(triggerPoint.Value, itemName); if (definitionNode != null) { peekableItems.Add(new UserDefinedPeekItem(textDocument.FilePath, definitionNode, itemName, _peekResultFactory, _shell)); } else { // Not found. Try internal functions IPeekableItem item = new InternalFunctionPeekItem(textDocument.FilePath, span, itemName, _peekResultFactory, _shell); if (item != null) { peekableItems.Add(item); } } } }