void RegisterCompletionCollectionEvents(CompletionCollection collection) { UnregisterCompletionCollectionEvents(); Debug.Assert(currentCompletionCollection == null); currentCompletionCollection = collection; collection.CurrentCompletionChanged += CompletionCollection_CurrentCompletionChanged; }
ITrackingPoint GetTrackingPoint(CompletionCollection coll) { var trackingSpan = coll.ApplicableTo; var snapshot = trackingSpan.TextBuffer.CurrentSnapshot; var point = trackingSpan.GetStartPoint(snapshot); return(snapshot.CreateTrackingPoint(point.Position, PointTrackingMode.Negative)); }
void UnregisterCompletionCollectionEvents() { if (currentCompletionCollection != null) { currentCompletionCollection.SelectionStatusChanged -= CompletionCollection_SelectionStatusChanged; currentCompletionCollection = null; } }
void UnregisterCompletionCollectionEvents() { if (currentCompletionCollection != null) { currentCompletionCollection.CurrentCompletionChanged -= CompletionCollection_CurrentCompletionChanged; currentCompletionCollection = null; } }
ICompletionClassifier GetCompletionClassifier(CompletionCollection collection) { ICompletionClassifier completionClassifier; if (!toClassifier.TryGetValue(collection, out completionClassifier)) { toClassifier.Add(collection, completionClassifier = completionClassifierAggregatorService.Create(collection)); } return(completionClassifier); }
public FilterMatchCompletionClassifier(IThemeClassificationTypes themeClassificationTypes, CompletionCollection completionCollection) { if (themeClassificationTypes == null) { throw new ArgumentNullException(nameof(themeClassificationTypes)); } if (completionCollection == null) { throw new ArgumentNullException(nameof(completionCollection)); } this.findMatchHighlightMarkerClassificationType = themeClassificationTypes.GetClassificationType(TextColor.FindMatchHighlightMarker); this.completionCollection = completionCollection; }
public FilterMatchCompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService, CompletionCollection completionCollection) { if (themeClassificationTypeService == null) { throw new ArgumentNullException(nameof(themeClassificationTypeService)); } if (completionCollection == null) { throw new ArgumentNullException(nameof(completionCollection)); } this.completionMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionMatchHighlight); this.completionCollection = completionCollection; }
public FrameworkElement Create(CompletionCollection collection, Completion completion) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (completion == null) { throw new ArgumentNullException(nameof(completion)); } Debug.Assert(collection.FilteredCollection.Contains(completion)); var classifier = GetCompletionClassifier(collection); var inputText = collection.ApplicableTo.GetText(collection.ApplicableTo.TextBuffer.CurrentSnapshot); var context = new CompletionClassifierContext(collection, completion, completion.DisplayText, inputText); return(TextBlockFactory.Create(context.DisplayText, classificationFormatMap.DefaultTextProperties, classifier.GetTags(context).Select(a => new TextRunPropertiesAndSpan(a.Span, classificationFormatMap.GetTextProperties(a.ClassificationType))), TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize)); }
public FrameworkElement Create(CompletionCollection collection, Completion completion) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (completion == null) { throw new ArgumentNullException(nameof(completion)); } Debug.Assert(collection.FilteredCollection.Contains(completion)); var classifier = GetCompletionClassifier(collection); var inputText = collection.ApplicableTo.GetText(collection.ApplicableTo.TextBuffer.CurrentSnapshot); var context = new CompletionClassifierContext(completion, inputText); var text = completion.DisplayText; var textBlock = new TextBlock(); int textOffset = 0; foreach (var tag in classifier.GetTags(context)) { if (textOffset < tag.Span.Start) { textBlock.Inlines.Add(CreateRun(text.Substring(textOffset, tag.Span.Start - textOffset), null)); } textBlock.Inlines.Add(CreateRun(text.Substring(tag.Span.Start, tag.Span.Length), tag.ClassificationType)); textOffset = tag.Span.End; } if (textOffset < text.Length) { textBlock.Inlines.Add(CreateRun(text.Substring(textOffset), null)); } var defProps = classificationFormatMap.DefaultTextProperties; if (!defProps.ForegroundBrushEmpty) { textBlock.Foreground = classificationFormatMap.DefaultTextProperties.ForegroundBrush; } return(textBlock); }
//----------------------------- private void parseGroup(XmlNodeList node, CompletionCollection group) { CompletionItem i; foreach (XmlElement e in node) { i = new CompletionItem(); i.Type = getType(e.Name); i.Text = e.GetAttribute(VAR_NAME); i.Description = e.GetAttribute(VAR_DESCRIPTION); i.IsDeprecated = e.GetAttribute(VAR_DEPRECATED).Equals("true"); i.Params = e.GetAttribute(VAR_PARAMS); group.Add(i); // if (e.HasChildNodes) { parseGroup(e.ChildNodes, i.Items); } } }
public void Start() { if (IsStarted) { throw new InvalidOperationException(); } if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; this.completionSources = CreateCompletionSources(); var list = new List <CompletionCollection>(); foreach (var source in completionSources) { source.AugmentCompletionSession(this, list); } foreach (var cc in list) { completionSets.Add(cc); } if (completionSets.Count == 0) { Dismiss(); } else { SelectedCompletionSet = completionSets[0]; completionPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this); if (completionPresenter == null) { Dismiss(); return; } PresenterChanged?.Invoke(this, EventArgs.Empty); completionSessionCommandTargetFilter = new CompletionSessionCommandTargetFilter(this); } }
public void Start() { if (IsStarted) { throw new InvalidOperationException(); } if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; this.completionSources = CreateCompletionSources(); var list = new List <CompletionCollection>(); foreach (var source in completionSources) { source.AugmentCompletionSession(this, list); } foreach (var cc in list) { completionCollections.Add(cc); } if (completionCollections.Count == 0) { Dismiss(); } else { SelectedCompletionCollection = completionCollections[0]; completionPresenter = completionPresenterService.Create(this); Debug.Assert(completionPresenter != null); sessionCommandTargetFilter = new SessionCommandTargetFilter(this); textViewPopup = new TextViewPopup(TextView, GetTrackingPoint(SelectedCompletionCollection), completionPresenter); textViewPopup.Show(); } }
/// <summary> /// Constructor /// </summary> /// <param name="collection">Collection</param> /// <param name="completion">Completion to classify</param> /// <param name="displayText">Text shown in the UI</param> /// <param name="inputText">Current user input text</param> public CompletionClassifierContext(CompletionCollection collection, Completion completion, string displayText, string inputText) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (completion == null) { throw new ArgumentNullException(nameof(completion)); } if (displayText == null) { throw new ArgumentNullException(nameof(displayText)); } if (inputText == null) { throw new ArgumentNullException(nameof(inputText)); } Collection = collection; Completion = completion; DisplayText = displayText; InputText = inputText; }
public ICompletionClassifier Create(CompletionCollection collection) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } var contentType = collection.ApplicableTo.TextBuffer.ContentType; var classifiers = new List <ICompletionClassifier>(); foreach (var lz in completionClassifierProviders) { if (!contentType.IsOfAnyType(lz.Metadata.ContentTypes)) { continue; } var classifier = lz.Value.Create(collection); if (classifier != null) { classifiers.Add(classifier); } } return(new CompletionClassifierAggregator(textClassifierAggregatorService.Value, classifiers.ToArray())); }
public void Start() { if (IsStarted) { throw new InvalidOperationException(); } if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; this.completionSources = CreateCompletionSources(); var list = new List <CompletionCollection>(); foreach (var source in completionSources) { source.AugmentCompletionSession(this, list); } foreach (var cc in list) { completionCollections.Add(cc); } if (completionCollections.Count == 0) { Dismiss(); } else { SelectedCompletionCollection = completionCollections[0]; completionPresenter = completionPresenterProvider.Create(this); Debug.Assert(completionPresenter != null); PresenterChanged?.Invoke(this, EventArgs.Empty); completionSessionCommandTargetFilter = new CompletionSessionCommandTargetFilter(this); } }
public ICompletionClassifier Create(CompletionCollection collection) => new CompletionClassifier(themeClassificationTypes);
public ICompletionClassifier Create(CompletionCollection completionSet) => new CompletionClassifier(themeClassificationTypeService);
public CompletionDocument() { document = new XmlDocument(); Items = new CompletionCollection(); }
public ICompletionClassifier Create(CompletionCollection collection) => new FilterMatchCompletionClassifier(themeClassificationTypeService, collection);
public CompletionItem() { Items = new CompletionCollection(); }