本文整理汇总了C#中ITrackingSpan类的典型用法代码示例。如果您正苦于以下问题:C# ITrackingSpan类的具体用法?C# ITrackingSpan怎么用?C# ITrackingSpan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITrackingSpan类属于命名空间,在下文中一共展示了ITrackingSpan类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CustomTrackingSpan
public CustomTrackingSpan(ITrackingSpan referenceSpan)
{
if (referenceSpan == null)
throw new ArgumentNullException("referenceSpan");
_referenceSpan = referenceSpan;
}
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:7,代码来源:CustomTrackingSpan.cs
示例2: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (!EnsureTreeInitialized() || session == null || qiContent == null)
return;
// Map the trigger point down to our buffer.
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
if (item == null || !item.IsValid)
return;
Declaration dec = item.FindType<Declaration>();
if (dec == null || !dec.IsValid || !_allowed.Contains(dec.PropertyName.Text.ToUpperInvariant()))
return;
string fontName = item.Text.Trim('\'', '"');
if (fonts.Families.SingleOrDefault(f => f.Name.Equals(fontName, StringComparison.OrdinalIgnoreCase)) != null)
{
FontFamily font = new FontFamily(fontName);
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
qiContent.Add(CreateFontPreview(font, 10));
qiContent.Add(CreateFontPreview(font, 11));
qiContent.Add(CreateFontPreview(font, 12));
qiContent.Add(CreateFontPreview(font, 14));
qiContent.Add(CreateFontPreview(font, 25));
qiContent.Add(CreateFontPreview(font, 40));
}
}
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:35,代码来源:FontQuickInfo.cs
示例3: ValueOrderSignature
public ValueOrderSignature(
string syntax,
string description,
ITrackingSpan trackingSpan,
ISignatureHelpSession session)
{
_propertyName = "Syntax";
_syntax = syntax ?? string.Empty;
_description = description;
_trackingSpan = trackingSpan;
_content = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", _propertyName, _syntax);
_nameParam = new CssPropertyNameParameter(this);
_currentParam = _nameParam;
_session = session;
// In order to dismiss this tip at the appropriate time, I need to listen
// to changes in the text buffer
if (_trackingSpan != null && _session != null)
{
_session.Dismissed += OnSessionDismissed;
_trackingSpan.TextBuffer.Changed += OnTextBufferChanged;
}
}
开发者ID:EdsonF,项目名称:WebEssentials2013,代码行数:26,代码来源:ValueOrderSignature.cs
示例4: GetSmartTagActions
public IEnumerable<ISmartTagAction> GetSmartTagActions(ParseItem item, int position, ITrackingSpan itemTrackingSpan, ITextView view)
{
Declaration dec = (Declaration)item;
if (!item.IsValid || position > dec.Colon.Start)
yield break;
RuleBlock rule = dec.FindType<RuleBlock>();
if (!rule.IsValid)
yield break;
ICssSchemaInstance schema = CssSchemaManager.SchemaManager.GetSchemaRootForBuffer(itemTrackingSpan.TextBuffer);
if (!dec.IsVendorSpecific())
{
IEnumerable<Declaration> vendors = VendorHelpers.GetMatchingVendorEntriesInRule(dec, rule, schema);
if (vendors.Any(v => v.Start > dec.Start))
{
yield return new VendorOrderSmartTagAction(itemTrackingSpan, vendors.Last(), dec);
}
}
else
{
ICssCompletionListEntry entry = VendorHelpers.GetMatchingStandardEntry(dec, schema);
if (entry != null && !rule.Declarations.Any(d => d.PropertyName != null && d.PropertyName.Text == entry.DisplayText))
{
yield return new MissingStandardSmartTagAction(itemTrackingSpan, dec, entry.DisplayText);
}
}
}
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:30,代码来源:VendorOrderSmartTagProvider.cs
示例5: SpellDictionarySmartTagAction
/// <summary>
/// Constructor for SpellDictionarySmartTagAction.
/// </summary>
/// <param name="span">Word to add to dictionary.</param>
/// <param name="dictionary">The dictionary (used to ignore the word).</param>
/// <param name="displayText">Text to show in the context menu for this action.</param>
public SpellDictionarySmartTagAction(ITrackingSpan span, IYandexDictionary dictionary, string displayText, Lang lang)
{
_span = span;
_dictionary = dictionary;
_lang = lang;
DisplayText = displayText;
}
开发者ID:gmalyshev,项目名称:Yandex.Speller.VS-extension,代码行数:13,代码来源:SpellDictionarySmartTagAction.cs
示例6: ShowToolTip
public void ShowToolTip(ITrackingSpan span, object toolTipContent) {
if (span == null)
throw new ArgumentNullException(nameof(span));
if (toolTipContent == null)
throw new ArgumentNullException(nameof(toolTipContent));
ShowToolTip(span, toolTipContent, PopupStyles.None);
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:ToolTipProvider.cs
示例7: AugmentQuickInfoSession
/// <summary>
/// Determine which pieces of Quickinfo content should be displayed
/// </summary>
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (_disposed)
throw new ObjectDisposedException("TestQuickInfoSource");
var triggerPoint = (SnapshotPoint) session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (triggerPoint == null)
return;
foreach (IMappingTagSpan<LuaTokenTag> curTag in _aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint)))
{
if (curTag.Tag.type == LuaTokenTypes.ReservedWord)
{
var tagSpan = curTag.Span.GetSpans(_buffer).First();
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
quickInfoContent.Add("A reserved word");
}
else if (curTag.Tag.type == LuaTokenTypes.Operators)
{
var tagSpan = curTag.Span.GetSpans(_buffer).First();
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
quickInfoContent.Add("A language operator");
}
}
}
开发者ID:Luk3M,项目名称:CharmLua,代码行数:31,代码来源:LuaQuickInfoSource.cs
示例8: AugmentQuickInfoSession
public void AugmentQuickInfoSession(
IQuickInfoSession session, IList<object> quickInfoContent,
out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
SnapshotPoint? subjectTriggerPoint =
session.GetTriggerPoint(textBuffer.CurrentSnapshot);
if ( !subjectTriggerPoint.HasValue ) {
return;
}
ITextSnapshot currentSnapshot = subjectTriggerPoint.Value.Snapshot;
SnapshotSpan querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
var tagAggregator = GetAggregator(session);
TextExtent extent = FindExtentAtPoint(subjectTriggerPoint);
if ( CheckForPrefixTag(tagAggregator, extent.Span) ) {
string text = extent.Span.GetText();
string url = FindNSUri(extent.Span, GetDocText(extent.Span));
applicableToSpan = currentSnapshot.CreateTrackingSpan(
extent.Span, SpanTrackingMode.EdgeInclusive
);
String toolTipText = String.Format("Prefix: {0}\r\nNamespace: {1}", text, url);
quickInfoContent.Add(toolTipText);
}
}
开发者ID:tomasr,项目名称:BetterXml,代码行数:26,代码来源:QuickInfo.cs
示例9: 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();
}
开发者ID:GeertVL,项目名称:roslyn,代码行数:32,代码来源:QuickInfoPresenter.QuickInfoPresenterSession.cs
示例10: AugmentQuickInfoSession
/// <summary>
/// Determine which pieces of Quickinfo content should be displayed
/// </summary>
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (_disposed)
throw new ObjectDisposedException("TestQuickInfoSource");
var triggerPoint = (SnapshotPoint) session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (triggerPoint == null)
return;
foreach (IMappingTagSpan<OokTokenTag> curTag in _aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint)))
{
if (curTag.Tag.type == OokTokenTypes.OokExclamation)
{
var tagSpan = curTag.Span.GetSpans(_buffer).First();
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
quickInfoContent.Add("Exclaimed Ook!");
}
else if (curTag.Tag.type == OokTokenTypes.OokQuestion)
{
var tagSpan = curTag.Span.GetSpans(_buffer).First();
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
quickInfoContent.Add("Question Ook?");
}
else if (curTag.Tag.type == OokTokenTypes.OokPeriod)
{
var tagSpan = curTag.Span.GetSpans(_buffer).First();
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
quickInfoContent.Add("Regular Ook.");
}
}
}
开发者ID:luyikk,项目名称:NLUATool,代码行数:37,代码来源:OokQuickInfoSource.cs
示例11: LowerCaseSmartTagAction
public LowerCaseSmartTagAction(ITrackingSpan span)
{
this.span = span;
tsnapshot = span.TextBuffer.CurrentSnapshot;
lower = span.GetText(tsnapshot).ToLower();
display = "Convert to lower case";
}
开发者ID:solondon,项目名称:VisualStudio2013andNETCookbookCode,代码行数:7,代码来源:LowerCaseSmartTagAction.cs
示例12: GenerateFieldSmartTagAction
public GenerateFieldSmartTagAction(ITrackingSpan span)
{
trackingSpan = span;
snapShot = span.TextBuffer.CurrentSnapshot;
m_upper = span.GetText(snapShot).ToUpper();
displayText = "生成属性";
}
开发者ID:qianlifeng,项目名称:easyvsx,代码行数:7,代码来源:GenerateFieldSmartTagAction.cs
示例13: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (session == null || qiContent == null || qiContent.Count > 0)
return;
// Map the trigger point down to our buffer.
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
var doc = JSONEditorDocument.FromTextBuffer(_buffer);
JSONParseItem item = doc.JSONDocument.ItemBeforePosition(point.Value.Position);
if (item == null || !item.IsValid)
return;
JSONMember member = item.FindType<JSONMember>();
if (member == null || member.Name == null)
return;
IJSONSchema schema = _schemaResolver.DetermineSchemaForTextBuffer(_buffer);
if (schema != null)
{
IJSONSchemaPropertyNameCompletionInfo info = GetInfo(schema, member);
if (info != null && !string.IsNullOrEmpty(info.PropertyDocumentation))
{
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
qiContent.Add(info.DisplayText + Environment.NewLine + info.PropertyDocumentation);
}
}
}
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:34,代码来源:PropertyQuickInfo.cs
示例14: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (session == null || qiContent == null)
return;
// Map the trigger point down to our buffer.
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
var snapshot = _buffer.CurrentSnapshot;
var classifier = _classifierService.GetClassifier(_buffer);
var doc = new SnapshotSpan(snapshot, 0, snapshot.Length);
var line = point.Value.GetContainingLine();
var idents = classifier.GetClassificationSpans(line.Extent);
bool handled = HandleVariables(qiContent, ref applicableToSpan, idents, point);
if (handled)
return;
HandleKeywords(qiContent, ref applicableToSpan, idents, point);
}
开发者ID:yannduran,项目名称:OpenCommandLine,代码行数:26,代码来源:CmdQuickInfo.cs
示例15: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
object eventHookupValue;
if (quickInfoContent.Count != 0 ||
session.Properties.TryGetProperty(QuickInfoUtilities.EventHookupKey, out eventHookupValue))
{
// No quickinfo if it's the event hookup popup.
return;
}
var position = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot);
if (position.HasValue)
{
var textView = session.TextView;
var args = new InvokeQuickInfoCommandArgs(textView, _subjectBuffer);
Controller controller;
if (_commandHandler.TryGetController(args, out controller))
{
controller.InvokeQuickInfo(position.Value, trackMouse: true, augmentSession: session);
}
}
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:25,代码来源:QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs
示例16: HandleVariables
private bool HandleVariables(IList<object> qiContent, ref ITrackingSpan applicableToSpan, IList<ClassificationSpan> spans, SnapshotPoint? point)
{
ClassificationSpan span;
string text = GetText(spans, point, PredefinedClassificationTypeNames.SymbolDefinition, out span);
if (string.IsNullOrWhiteSpace(text))
return false;
string value = Environment.GetEnvironmentVariable(text.Trim('%'));
if (string.IsNullOrEmpty(value))
return false;
string displayText = value;
if (value.Equals("path", StringComparison.OrdinalIgnoreCase))
displayText = string.Join(Environment.NewLine, value.Split(';'));
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(span.Span, SpanTrackingMode.EdgeNegative);
qiContent.Add(displayText);
string expanded = Environment.ExpandEnvironmentVariables(value);
if (expanded != value)
qiContent.Add(expanded);
return true;
}
开发者ID:yannduran,项目名称:OpenCommandLine,代码行数:28,代码来源:CmdQuickInfo.cs
示例17: CompletionAnalysis
internal CompletionAnalysis(IServiceProvider serviceProvider, ITextView view, ITrackingSpan span, ITextBuffer textBuffer, CompletionOptions options) {
_view = view;
_span = span;
_serviceProvider = serviceProvider;
_textBuffer = textBuffer;
_options = (options == null) ? new CompletionOptions() : options.Clone();
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:7,代码来源:CompletionAnalysis.cs
示例18: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
var triggerPoint = (SnapshotPoint)session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (triggerPoint == null)
return;
// find each span that looks like a token and look it up in the dictionary
foreach (IMappingTagSpan<PkgDefTokenTag> curTag in _aggregator.GetTags(new SnapshotSpan(triggerPoint, triggerPoint)))
{
if (curTag.Tag.type == PkgDefLanguageTokens.Token)
{
SnapshotSpan tagSpan = curTag.Span.GetSpans(_buffer).First();
if (PkgDefTokenTagger.ValidTokens.Keys.Contains(tagSpan.GetText()))
{
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(tagSpan, SpanTrackingMode.EdgeExclusive);
string quickInfo = PkgDefTokenTagger.ValidTokens[tagSpan.GetText()];
System.Diagnostics.Debug.WriteLine(quickInfo);
quickInfoContent.Add(quickInfo);
}
}
}
}
开发者ID:smartmobili,项目名称:parsing,代码行数:25,代码来源:PkgDefTokenQuickInfoSource.cs
示例19: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (!EnsureTreeInitialized() || session == null || qiContent == null)
return;
// Map the trigger point down to our buffer.
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
if (item == null || !item.IsValid)
return;
Selector sel = item.FindType<Selector>();
if (sel == null)
return;
// Mixins don't have specificity
if (sel.SimpleSelectors.Count == 1 && sel.SimpleSelectors[0].SubSelectors.Count == 1 && sel.SimpleSelectors[0].SubSelectors[0] is LessMixinDeclaration)
return;
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
string content = GenerateContent(sel);
qiContent.Add(content);
}
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:28,代码来源:SelectorQuickInfo.cs
示例20: UpperCaseSuggestedAction
public UpperCaseSuggestedAction(ITrackingSpan span)
{
_span = span;
_snapshot = span.TextBuffer.CurrentSnapshot;
_upper = span.GetText(_snapshot).ToUpper();
_display = string.Format("Convert '{0}' to upper case", span.GetText(_snapshot));
}
开发者ID:Sunzhuokai,项目名称:VSSDK-Extensibility-Samples,代码行数:7,代码来源:UpperCaseSuggestedAction.cs
注:本文中的ITrackingSpan类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论