本文整理汇总了C#中IQuickInfoSession类的典型用法代码示例。如果您正苦于以下问题:C# IQuickInfoSession类的具体用法?C# IQuickInfoSession怎么用?C# IQuickInfoSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IQuickInfoSession类属于命名空间,在下文中一共展示了IQuickInfoSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
var triggerPoint = session.GetTriggerPoint(buffer.CurrentSnapshot);
if (triggerPoint == null)
return;
ITextDocument doc;
if (!provider.TextDocumentFactoryService.TryGetTextDocument(buffer, out doc))
return;
IOutputWindowPane diagnostics = provider.OutputWindowService.TryGetPane(OutputWindowPanes.DartVSDiagnostics);
if (diagnostics != null)
diagnostics.WriteLine("Quick info requested for: " + doc.FilePath);
// Figure out if this is a recalculate for an existing span (not sure if this is the best way of supporting async...?)
if (inProgressPosition != null && inProgressPosition.Value == triggerPoint.Value.Position)
{
UpdateTooltip(session, quickInfoContent, out applicableToSpan);
}
else
{
applicableToSpan = GetApplicableToSpan(triggerPoint);
var ignoredTask = StartTooltipRequestAsync(session, quickInfoContent, applicableToSpan, triggerPoint, doc.FilePath);
}
}
示例3: 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;
JSONEditorDocument doc = JSONEditorDocument.FromTextBuffer(_buffer);
JSONParseItem item = doc.JSONDocument.ItemBeforePosition(point.Value.Position);
if (item == null || !item.IsValid)
return;
JSONMember dependency = item.FindType<JSONMember>();
if (dependency == null || dependency.Name != item)
return;
var parent = dependency.Parent.FindType<JSONMember>();
if (parent == null || !parent.UnquotedNameText.EndsWith("dependencies", StringComparison.OrdinalIgnoreCase))
return;
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(item.Start, item.Length, SpanTrackingMode.EdgeNegative);
UIElement element = CreateTooltip(dependency.UnquotedNameText, item);
if (element != null)
qiContent.Add(element);
}
示例4: QuickInfoPresenterSession
public QuickInfoPresenterSession(IQuickInfoBroker quickInfoBroker, ITextView textView, ITextBuffer subjectBuffer, IQuickInfoSession sessionOpt)
{
_quickInfoBroker = quickInfoBroker;
_textView = textView;
_subjectBuffer = subjectBuffer;
_editorSessionOpt = sessionOpt;
}
示例5: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
if (session == null)
{
throw new ArgumentNullException("session");
}
if (quickInfoContent == null)
{
throw new ArgumentNullException("quickInfoContent");
}
TemplateAnalysis analysis = this.analyzer.CurrentAnalysis;
SnapshotPoint? triggerPoint = session.GetTriggerPoint(analysis.TextSnapshot);
if (triggerPoint != null && analysis.Template != null)
{
string description;
Span applicableTo;
if (analysis.Template.TryGetDescription(triggerPoint.Value.Position, out description, out applicableTo))
{
quickInfoContent.Add(description);
applicableToSpan = analysis.TextSnapshot.CreateTrackingSpan(applicableTo, SpanTrackingMode.EdgeExclusive);
return;
}
}
applicableToSpan = null;
}
示例6: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan) {
applicableToSpan = null;
var modifier = ModifierKeys.Control | ModifierKeys.Shift;
if((Keyboard.Modifiers & modifier) != modifier) {
return;
}
var parseResult = ParserService.ParseResult;
if (parseResult == null) {
return;
}
// Map the trigger point down to our buffer.
SnapshotPoint? subjectTriggerPoint = session.GetTriggerPoint(parseResult.Snapshot);
if(!subjectTriggerPoint.HasValue) {
return;
}
var triggerToken = parseResult.SyntaxTree.Tokens.FindAtPosition(subjectTriggerPoint.Value.Position);
if(triggerToken.IsMissing || triggerToken.Parent == null) {
return;
}
var location = triggerToken.GetLocation();
qiContent.Add($"{triggerToken.Type} ({triggerToken.Classification}) Ln {location?.StartLine + 1} Ch {location?.StartCharacter + 1}\r\n{triggerToken.Parent?.GetType().Name}");
applicableToSpan = parseResult.Snapshot.CreateTrackingSpan(
triggerToken.Start,
triggerToken.Length,
SpanTrackingMode.EdgeExclusive);
}
示例7: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
{
SnapshotPoint? triggerPoint = session.GetTriggerPoint(TextBuffer.CurrentSnapshot);
if (!triggerPoint.HasValue)
{
applicableToSpan = null;
return;
}
JavaQuickInfo qi = null;
if (session.Properties.TryGetProperty<JavaQuickInfo>(typeof(JavaQuickInfo), out qi))
{
//quickInfoContent.Clear();
foreach (var o in qi.QuickInfoContent)
{
var display = o;
if (display.Contains("{"))
display = display.Substring(0, display.IndexOf("{"));
if (display.Contains("[in"))
display = display.Substring(0, display.IndexOf("[in"));
//quickInfoContent.Add(o);
quickInfoContent.Add(display); // TODO: Workaround to only show the declaration of the type and not the full location string
}
// Get whole word under point
ITextStructureNavigator navigator = Provider.NavigatorService.GetTextStructureNavigator(TextBuffer);
TextExtent extent = navigator.GetExtentOfWord(triggerPoint.Value);
applicableToSpan = triggerPoint.Value.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive);
}
else
applicableToSpan = null;
}
示例8: AugmentQuickInfoSession
public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qiContent, out ITrackingSpan applicableToSpan)
{
applicableToSpan = null;
if (!EnsureTreeInitialized() || session == null || qiContent == null)
return;
SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (!point.HasValue)
return;
ParseItem item = _tree.StyleSheet.ItemBeforePosition(point.Value.Position);
if (item == null || !item.IsValid)
return;
UrlItem urlItem = item.FindType<UrlItem>();
if (urlItem != null && urlItem.UrlString != null && urlItem.UrlString.IsValid)
{
string url = GetFileName(urlItem.UrlString.Text.Trim('\'', '"'));
if (!string.IsNullOrEmpty(url))
{
applicableToSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(point.Value.Position, 1, SpanTrackingMode.EdgeNegative);
var image = CreateImage(url);
if (image != null && image.Source != null)
{
qiContent.Add(image);
qiContent.Add(Math.Round(image.Source.Width) + "x" + Math.Round(image.Source.Height));
}
}
}
}
示例9: 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));
}
}
示例10: HACK_SetShimQuickInfoSessionWorker
private void HACK_SetShimQuickInfoSessionWorker(ITextView textView, IQuickInfoSession quickInfoSession)
{
var properties = textView.Properties.PropertyList;
var shimController = properties.Single(p => p.Value != null && p.Value.GetType().Name == "ShimQuickInfoController").Value;
var sessionField = shimController.GetType().GetField("_session", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
sessionField.SetValue(shimController, quickInfoSession);
}
示例11: 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);
}
示例12: AnalyzeExpression
private ExpressionAnalysis AnalyzeExpression(IQuickInfoSession session) {
return VsProjectAnalyzer.AnalyzeExpression(
_textBuffer.CurrentSnapshot,
session.CreateTrackingSpan(_textBuffer),
false
);
}
示例13: 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);
}
}
}
示例14: 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);
}
示例15: 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.");
}
}
}