本文整理汇总了C#中ITrackingPoint类的典型用法代码示例。如果您正苦于以下问题:C# ITrackingPoint类的具体用法?C# ITrackingPoint怎么用?C# ITrackingPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITrackingPoint类属于命名空间,在下文中一共展示了ITrackingPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Model
private Model(
DisconnectedBufferGraph disconnectedBufferGraph,
IList<CompletionItem> totalItems,
IList<CompletionItem> filteredItems,
CompletionItem selectedItem,
bool isHardSelection,
bool isUnique,
bool useSuggestionCompletionMode,
CompletionItem builder,
CompletionItem defaultBuilder,
CompletionTriggerInfo triggerInfo,
ITrackingPoint commitSpanEndPoint,
bool dismissIfEmpty)
{
Contract.ThrowIfNull(selectedItem);
Contract.ThrowIfFalse(totalItems.Count != 0, "Must have at least one item.");
Contract.ThrowIfFalse(filteredItems.Count != 0, "Must have at least one filtered item.");
Contract.ThrowIfFalse(filteredItems.Contains(selectedItem) || defaultBuilder == selectedItem, "Selected item must be in filtered items.");
_disconnectedBufferGraph = disconnectedBufferGraph;
this.TotalItems = totalItems;
this.FilteredItems = filteredItems;
this.SelectedItem = selectedItem;
this.IsHardSelection = isHardSelection;
this.IsUnique = isUnique;
this.UseSuggestionCompletionMode = useSuggestionCompletionMode;
this.Builder = builder;
this.DefaultBuilder = defaultBuilder;
this.TriggerInfo = triggerInfo;
this.CommitTrackingSpanEndPoint = commitSpanEndPoint;
this.DismissIfEmpty = dismissIfEmpty;
}
示例2: GoToSourceImpl
public override IEnumerable<INavigateToTarget> GoToSourceImpl(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint)
{
if (triggerPoint == null)
return new INavigateToTarget[0];
return base.GoToSourceImpl(gotoSourceType, triggerPoint);
}
示例3: FindTokenSpanAtPosition
private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession session)
{
SnapshotPoint currentPoint = (session.TextView.Caret.Position.BufferPosition);
ITextStructureNavigator navigator = _provider.NavigatorService.GetTextStructureNavigator(_textBuffer);
TextExtent extent = navigator.GetExtentOfWord(currentPoint);
return currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive);
}
示例4: FindTokenSpanAtPosition
private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, IIntellisenseSession session)
{
var currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1;
var navigator = _sourceProvider.NavigatorService.GetTextStructureNavigator(_textBuffer);
var extent = navigator.GetExtentOfWord(currentPoint);
return currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive);
}
示例5: Model
private Model(
DisconnectedBufferGraph disconnectedBufferGraph,
IList<CompletionItem> totalItems,
IList<CompletionItem> filteredItems,
CompletionItem selectedItem,
ImmutableArray<CompletionItemFilter> completionItemFilters,
ImmutableDictionary<CompletionItemFilter, bool> filterState,
IReadOnlyDictionary<CompletionItem, string> completionItemToFilterText,
bool isHardSelection,
bool isUnique,
bool useSuggestionCompletionMode,
CompletionItem builder,
CompletionItem defaultBuilder,
CompletionTriggerInfo triggerInfo,
ITrackingPoint commitSpanEndPoint,
bool dismissIfEmpty)
{
Contract.ThrowIfFalse(totalItems.Count != 0, "Must have at least one item.");
_disconnectedBufferGraph = disconnectedBufferGraph;
this.TotalItems = totalItems;
this.FilteredItems = filteredItems;
this.FilterState = filterState;
this.SelectedItem = selectedItem;
this.CompletionItemFilters = completionItemFilters;
this.CompletionItemToFilterText = completionItemToFilterText;
this.IsHardSelection = isHardSelection;
this.IsUnique = isUnique;
this.UseSuggestionCompletionMode = useSuggestionCompletionMode;
this.Builder = builder;
this.DefaultBuilder = defaultBuilder;
this.TriggerInfo = triggerInfo;
this.CommitTrackingSpanEndPoint = commitSpanEndPoint;
this.DismissIfEmpty = dismissIfEmpty;
}
示例6: FindTokenSpanAtPosition
private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession session, out bool isUpperCase)
{
SnapshotPoint currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1;
ITextStructureNavigator navigator = sourceProvider.NavigatorService.GetTextStructureNavigator(textBuffer);
TextExtent extent = navigator.GetExtentOfWord(currentPoint);
string text = extent.Span.GetText();
string strText = navigator.GetExtentOfWord((session.TextView.Caret.Position.BufferPosition) - text.Length - 1).Span.GetText();
int uppercasePosition = 0;
int underscorePosition = 0;
if (NLAConfiguration.UnderscoreSeparator)
{
uppercasePosition = text.LastIndexOf("_");
if (uppercasePosition > 0)
{
uppercasePosition = uppercasePosition + 1; // get passed the underscore character
underscorePosition = uppercasePosition;
}
}
else if (NLAConfiguration.UpperCaseSeparator)
{
uppercasePosition = text.LastIndexOf(text.LastOrDefault(c => char.IsUpper(c)));
underscorePosition = uppercasePosition - 1;
}
isUpperCase = char.IsUpper(text[0]);
if (!NLAConfiguration.AllowInStrings)
{
var line = currentPoint.GetContainingLine();
var doubleQuote = line.GetText().IndexOf("\"");
var singleQuote = line.GetText().IndexOf("'");
if ((doubleQuote >= 0 && line.Start.Position + doubleQuote <= currentPoint.Position) || (singleQuote >= 0 && line.Start.Position + singleQuote <= currentPoint.Position))
{
return null;
}
}
if (uppercasePosition > 0)
{
var span = currentPoint.Snapshot.CreateTrackingSpan(extent.Span.Start.Position + uppercasePosition, text.Length - uppercasePosition, SpanTrackingMode.EdgeInclusive);
var underscoreSpan = currentPoint.Snapshot.CreateTrackingSpan(extent.Span.Start.Position + underscorePosition, text.Length - underscorePosition, SpanTrackingMode.EdgeInclusive);
if (!NLAConfiguration.UnderscoreSeparator && underscoreSpan.GetText(currentPoint.Snapshot).StartsWith("_")) // avoid this "word_Composition" when camel case is not active
{
return null;
}
text = span.GetText(currentPoint.Snapshot);
if (!String.IsNullOrEmpty(text))
{
isUpperCase = char.IsUpper(text[0]);
}
return span;
}
return currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive);
}
示例7: FindTokenSpanAtPosition
private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession completionSession)
{
SnapshotPoint ssPoint = (completionSession.TextView.Caret.Position.BufferPosition) - 1;
ITextStructureNavigator navigator = sourceProvider.TextNavigatorService.GetTextStructureNavigator(this.textBuffer);
TextExtent textExtent = navigator.GetExtentOfWord(ssPoint);
return ssPoint.Snapshot.CreateTrackingSpan(textExtent.Span, SpanTrackingMode.EdgeInclusive);
}
示例8: TriggerQuickInfo
public IQuickInfoSession TriggerQuickInfo(ITextView textView, ITrackingPoint triggerPoint, bool trackMouse) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
var session = CreateQuickInfoSession(textView, triggerPoint, trackMouse);
session.Start();
return session.IsDismissed ? null : session;
}
示例9: TriggerSignatureHelp
public ISignatureHelpSession TriggerSignatureHelp(ITextView textView, ITrackingPoint triggerPoint, bool trackCaret) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
var session = CreateSignatureHelpSession(textView, triggerPoint, trackCaret);
session.Start();
return session.IsDismissed ? null : session;
}
示例10: CreateQuickInfoSession
public IQuickInfoSession CreateQuickInfoSession(ITextView textView, ITrackingPoint triggerPoint, bool trackMouse) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
var stack = intellisenseSessionStackMapService.Value.GetStackForTextView(textView);
var session = new QuickInfoSession(textView, triggerPoint, trackMouse, intellisensePresenterFactoryService.Value, quickInfoSourceProviders);
stack.PushSession(session);
return session;
}
示例11: GetTriggerPoint
public static SnapshotPoint? GetTriggerPoint(ITextView textView, ITrackingPoint triggerPoint, ITextSnapshot textSnapshot) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
if (textSnapshot == null)
throw new ArgumentNullException(nameof(textSnapshot));
return triggerPoint.GetPoint(textView.TextSnapshot);
}
示例12: CreateSignatureHelpSession
public ISignatureHelpSession CreateSignatureHelpSession(ITextView textView, ITrackingPoint triggerPoint, bool trackCaret) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
var stack = intellisenseSessionStackMapService.Value.GetStackForTextView(textView);
var session = new SignatureHelpSession(textView, triggerPoint, trackCaret, intellisensePresenterFactoryService.Value, signatureHelpSourceProviders);
currentLineSpaceReservationService.Value.SessionCreated(session);
stack.PushSession(session);
return session;
}
示例13: CreateSmartTagSession
public ISmartTagSession CreateSmartTagSession(ITextView textView, SmartTagType type, ITrackingPoint triggerPoint, SmartTagState state) {
var session = new MockSmartTagSession(this) {
TextView = textView,
Type = type,
TriggerPoint = triggerPoint,
State = state
};
lock (_sessions) {
_sessions.Add(new KeyValuePair<ITextView, ISmartTagSession>(textView, session));
}
session.Dismissed += Session_Dismissed;
return session;
}
示例14: Setup
public void Setup()
{
_stubSession = MockRepository.GenerateStub<ICompletionSession>();
_stubTextBuffer = MockRepository.GenerateStub<ITextBuffer>();
_stubViewExplorer = MockRepository.GenerateStub<IViewExplorer>();
_stubTrackingPoint = MockRepository.GenerateStub<ITrackingPoint>();
_stubTrackingSpan = MockRepository.GenerateStub<ITrackingSpan>();
_stubSnapshot = MockRepository.GenerateStub<ITextSnapshot>();
_stubTextBuffer.Stub(x => x.CurrentSnapshot).Return(_stubSnapshot);
_stubSession.Stub(x => x.GetTriggerPoint(_stubTextBuffer)).Return(_stubTrackingPoint);
_stubTrackingPoint.Stub(x => x.GetPoint(_stubSnapshot)).Return(new SnapshotPoint(_stubSnapshot, 0));
_stubViewExplorer.Stub(x => x.GetRelatedPartials()).Return(new List<string>());
}
示例15: FindTokenSpanAtPosition
/// <summary>
/// Finds the span of completion text to replace and use for searching.
/// </summary>
ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession session, CompletionMode mode)
{
var end = session.TextView.Caret.Position.BufferPosition;
var start = end;
var ch = start.GetChar();
while (start.Position > 0)
{
var temp = start - 1;
ch = temp.GetChar();
if (!(char.IsLetterOrDigit(ch) || ch == ':' || ch == '_') || ch == '"' || ch == '\'' || ch == '.')
break;
start = temp;
}
var span = Span.FromBounds(start.Position, end.Position);
return start.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeInclusive);
}