本文整理汇总了C#中ITrackingSpan.GetStartTrackingPoint方法的典型用法代码示例。如果您正苦于以下问题:C# ITrackingSpan.GetStartTrackingPoint方法的具体用法?C# ITrackingSpan.GetStartTrackingPoint怎么用?C# ITrackingSpan.GetStartTrackingPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITrackingSpan
的用法示例。
在下文中一共展示了ITrackingSpan.GetStartTrackingPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PresentItem
public void PresentItem(ITrackingSpan triggerSpan, QuickInfoItem item, bool trackMouse)
{
AssertIsForeground();
_triggerSpan = triggerSpan;
_item = item;
// It's a new list of items. Either create the editor session if this is the first time, or ask the
// editor session that we already have to recalculate.
if (_editorSessionOpt == null || _editorSessionOpt.IsDismissed)
{
// We're tracking the caret. Don't have the editor do it.
var triggerPoint = triggerSpan.GetStartTrackingPoint(PointTrackingMode.Negative);
_editorSessionOpt = _quickInfoBroker.CreateQuickInfoSession(_textView, triggerPoint, trackMouse: trackMouse);
_editorSessionOpt.Dismissed += (s, e) => OnEditorSessionDismissed();
}
// So here's the deal. We cannot create the editor session and give it the right
// signatures (even though we know what they are). Instead, the session with
// call back into the ISignatureHelpSourceProvider (which is us) to get those
// values. It will pass itself along with the calls back into
// ISignatureHelpSourceProvider. So, in order to make that connection work, we
// add properties to the session so that we can call back into ourselves, get
// the signatures and add it to the session.
if (!_editorSessionOpt.Properties.ContainsProperty(s_augmentSessionKey))
{
_editorSessionOpt.Properties.AddProperty(s_augmentSessionKey, this);
}
_editorSessionOpt.Recalculate();
}
示例2: PresentItems
public void PresentItems(
ITrackingSpan triggerSpan,
IList<SignatureHelpItem> signatureHelpItems,
SignatureHelpItem selectedItem,
int? selectedParameter)
{
_signatureHelpItems = signatureHelpItems;
_selectedItem = selectedItem;
// Create all the editor signatures for the sig help items we have.
this.CreateSignatures(triggerSpan, selectedParameter);
// It's a new list of items. Either create the editor session if this is the
// first time, or ask the editor session that we already have to recalculate.
if (_editorSessionOpt == null)
{
// We're tracking the caret. Don't have the editor do it.
_editorSessionOpt = _sigHelpBroker.CreateSignatureHelpSession(
_textView,
triggerSpan.GetStartTrackingPoint(PointTrackingMode.Negative),
trackCaret: false);
var debugTextView = _textView as IDebuggerTextView;
if (debugTextView != null && !debugTextView.IsImmediateWindow)
{
debugTextView.HACK_StartCompletionSession(_editorSessionOpt);
}
_editorSessionOpt.Dismissed += (s, e) => OnEditorSessionDismissed();
_editorSessionOpt.SelectedSignatureChanged += OnSelectedSignatureChanged;
}
// So here's the deal. We cannot create the editor session and give it the right
// signatures (even though we know what they are). Instead, the session with
// call back into the ISignatureHelpSourceProvider (which is us) to get those
// values. It will pass itself along with the calls back into
// ISignatureHelpSourceProvider. So, in order to make that connection work, we
// add properties to the session so that we can call back into ourselves, get
// the signatures and add it to the session.
if (!_editorSessionOpt.Properties.ContainsProperty(s_augmentSessionKey))
{
_editorSessionOpt.Properties.AddProperty(s_augmentSessionKey, this);
}
try
{
// Don't want to get any callbacks while we do this.
_ignoreSelectionStatusChangedEvent = true;
_editorSessionOpt.Recalculate();
// Now let the editor know what the currently selected item is.
Contract.Requires(_signatureMap.ContainsKey(selectedItem));
Contract.ThrowIfNull(_signatureMap);
var defaultValue = _signatureMap.GetValueOrDefault(_selectedItem);
if (_editorSessionOpt != null)
{
_editorSessionOpt.SelectedSignature = defaultValue;
}
}
finally
{
_ignoreSelectionStatusChangedEvent = false;
}
}
示例3: PresentItems
public void PresentItems(
ITrackingSpan triggerSpan,
IList<PresentationItem> completionItems,
PresentationItem selectedItem,
PresentationItem suggestionModeItem,
bool suggestionMode,
bool isSoftSelected,
ImmutableArray<CompletionItemFilter> completionItemFilters,
IReadOnlyDictionary<CompletionItem, string> completionItemToFilterText)
{
AssertIsForeground();
// check if this update is still relevant
if (_textView.IsClosed || _isDismissed)
{
return;
}
if (triggerSpan != null)
{
_completionSet.SetTrackingSpan(triggerSpan);
}
_ignoreSelectionStatusChangedEvent = true;
try
{
_completionSet.SetCompletionItems(
completionItems, selectedItem, suggestionModeItem, suggestionMode,
isSoftSelected, completionItemFilters, completionItemToFilterText);
}
finally
{
_ignoreSelectionStatusChangedEvent = false;
}
if (_editorSessionOpt == null)
{
// We're tracking the caret. Don't have the editor do it.
// Map the span instead of a point to avoid affinity problems.
_editorSessionOpt = _completionBroker.CreateCompletionSession(
_textView,
triggerSpan.GetStartTrackingPoint(PointTrackingMode.Negative),
trackCaret: false);
var debugTextView = _textView as IDebuggerTextView;
if (debugTextView != null && !debugTextView.IsImmediateWindow)
{
debugTextView.HACK_StartCompletionSession(_editorSessionOpt);
}
_editorSessionOpt.Dismissed += (s, e) => OnEditorSessionDismissed();
// So here's the deal. We cannot create the editor session and give it the right
// items (even though we know what they are). Instead, the session will call
// back into the ICompletionSourceProvider (which is us) to get those values. It
// will pass itself along with the calls back into ICompletionSourceProvider.
// So, in order to make that connection work, we add properties to the session
// so that we can call back into ourselves, get the items and add it to the
// session.
_editorSessionOpt.Properties.AddProperty(Key, this);
_editorSessionOpt.Start();
}
// Call so that the editor will refresh the completion text to embolden.
_editorSessionOpt?.Match();
}