public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator<IClassificationTag> aggregator, IClassificationFormatMap formatMap, IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService) { _view = view; _layer = view.GetAdornmentLayer("BackgroundColorFix"); _aggregator = aggregator; _formatMap = formatMap; _fcService = fcService; _adaptersService = adaptersService; _view.LayoutChanged += OnLayoutChanged; // Here are the hacks for making the normal classification background go away: _formatMap.ClassificationFormatMappingChanged += (sender, args) => { if (!_inUpdate && _view != null && !_view.IsClosed) { _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); } }; _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); }
public static FrameworkElement Create(IClassificationFormatMap classificationFormatMap, string text, List<TextClassificationTag> tagsList, TextElementFlags flags) { bool useFastTextBlock = (flags & (TextElementFlags.TrimmingMask | TextElementFlags.WrapMask | TextElementFlags.FilterOutNewLines)) == (TextElementFlags.NoTrimming | TextElementFlags.NoWrap | TextElementFlags.FilterOutNewLines); bool filterOutNewLines = (flags & TextElementFlags.FilterOutNewLines) != 0; if (tagsList.Count != 0) { if (useFastTextBlock) { return new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0, new TextSrc { text = ToString(text, filterOutNewLines), classificationFormatMap = classificationFormatMap, tagsList = tagsList.ToArray(), }); } var propsSpans = tagsList.Select(a => new TextRunPropertiesAndSpan(a.Span, classificationFormatMap.GetTextProperties(a.ClassificationType))); var textBlock = TextBlockFactory.Create(text, classificationFormatMap.DefaultTextProperties, propsSpans, TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize | (filterOutNewLines ? TextBlockFactory.Flags.FilterOutNewlines : 0)); textBlock.TextTrimming = GetTextTrimming(flags); textBlock.TextWrapping = GetTextWrapping(flags); return textBlock; } FrameworkElement fwElem; if (useFastTextBlock) { fwElem = new FastTextBlock((flags & TextElementFlags.NewFormatter) != 0) { Text = ToString(text, filterOutNewLines) }; } else { fwElem = new TextBlock { Text = ToString(text, filterOutNewLines), TextTrimming = GetTextTrimming(flags), TextWrapping = GetTextWrapping(flags), }; } return InitializeDefault(classificationFormatMap, fwElem); }
public CurrentColumnAdornment( IWpfTextView view, IClassificationFormatMap formatMap, IClassificationType formatType, IVsfSettings settings) { this.view = view; this.formatMap = formatMap; this.formatType = formatType; this.settings = settings; this.columnRect = new Rectangle(); layer = view.GetAdornmentLayer(Constants.COLUMN_HIGHLIGHT); view.Caret.PositionChanged += OnCaretPositionChanged; view.ViewportWidthChanged += OnViewportChanged; view.ViewportHeightChanged += OnViewportChanged; view.LayoutChanged += OnViewLayoutChanged; view.TextViewModel.EditBuffer.PostChanged += OnBufferPostChanged; view.Closed += OnViewClosed; view.Options.OptionChanged += OnSettingsChanged; this.settings.SettingsChanged += OnSettingsChanged; formatMap.ClassificationFormatMappingChanged += OnClassificationFormatMappingChanged; CreateDrawingObjects(); }
TextBlock TryCreateObject(StringBuilder sb, ImmutableArray<TaggedText> taggedParts, IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService) { if (taggedParts.IsDefaultOrEmpty) return null; var text = ToString(sb, taggedParts); var propsSpans = CreateTextRunPropertiesAndSpans(taggedParts, classificationFormatMap, themeClassificationTypeService); return TextBlockFactory.Create(text, classificationFormatMap.DefaultTextProperties, propsSpans, TextBlockFactory.Flags.DisableSetTextBlockFontFamily | TextBlockFactory.Flags.DisableFontSize); }
public TextCaret(IWpfTextView textView, IAdornmentLayer caretLayer, ISmartIndentationService smartIndentationService, IClassificationFormatMap classificationFormatMap) { if (textView == null) throw new ArgumentNullException(nameof(textView)); if (caretLayer == null) throw new ArgumentNullException(nameof(caretLayer)); if (smartIndentationService == null) throw new ArgumentNullException(nameof(smartIndentationService)); if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); this.textView = textView; imeState = new ImeState(); this.smartIndentationService = smartIndentationService; preferredXCoordinate = 0; __preferredYCoordinate = 0; Affinity = PositionAffinity.Successor; currentPosition = new VirtualSnapshotPoint(textView.TextSnapshot, 0); textView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority; textView.TextBuffer.ContentTypeChanged += TextBuffer_ContentTypeChanged; textView.Options.OptionChanged += Options_OptionChanged; textView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true); textView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true); textView.LayoutChanged += TextView_LayoutChanged; textCaretLayer = new TextCaretLayer(this, caretLayer, classificationFormatMap); InputMethod.SetIsInputMethodSuspended(textView.VisualElement, true); }
internal EasyMotionAdornmentController(IEasyMotionUtil easyMotionUtil, IWpfTextView wpfTextview, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap) { _easyMotionUtil = easyMotionUtil; _wpfTextView = wpfTextview; _editorFormatMap = editorFormatMap; _classificationFormatMap = classificationFormatMap; }
public XmlCommentShrinker(ITextView view, IClassificationFormatMap formatMap) { _formatMap = formatMap; _formatMap.ClassificationFormatMappingChanged += (sender, e) => ShrinkComments(); view.GotAggregateFocus += OnGotAggregateFocus; ShrinkComments(); }
public AttachProcessVM(Dispatcher dispatcher, bool syntaxHighlight, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider) { this.dispatcher = dispatcher; processContext = new ProcessContext(classificationFormatMap, textElementProvider) { SyntaxHighlight = syntaxHighlight, }; processList = new ObservableCollection<ProcessVM>(); Refresh(); }
public BoldAsItalicsFormatter( IWpfTextView textView, IClassificationFormatMap map, IVsfSettings settings) { this.formatMap = map; this.settings = settings; textView.GotAggregateFocus += OnViewFocus; this.formatMap.ClassificationFormatMappingChanged += OnMappingChanged; }
IEnumerable<TextRunPropertiesAndSpan> CreateTextRunPropertiesAndSpans(ImmutableArray<TaggedText> taggedParts, IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService) { int pos = 0; foreach (var part in taggedParts) { var color = TextTagsHelper.ToTextColor(part.Tag); var classificationType = themeClassificationTypeService.GetClassificationType(color); yield return new TextRunPropertiesAndSpan(new Span(pos, part.Text.Length), classificationFormatMap.GetTextProperties(classificationType)); pos += part.Text.Length; } }
public CodeToolTipProvider(IWpfTextView wpfTextView, IDotNetImageService dotNetImageService, IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService, bool syntaxHighlight) { this.wpfTextView = wpfTextView ?? throw new ArgumentNullException(nameof(wpfTextView)); this.dotNetImageService = dotNetImageService ?? throw new ArgumentNullException(nameof(dotNetImageService)); this.classificationFormatMap = classificationFormatMap ?? throw new ArgumentNullException(nameof(classificationFormatMap)); this.themeClassificationTypeService = themeClassificationTypeService ?? throw new ArgumentNullException(nameof(themeClassificationTypeService)); this.syntaxHighlight = syntaxHighlight; writers = new List <CodeToolTipWriter>(); CreateNewOutput(); }
public RainbowHighlight( IWpfTextView textView, IClassificationFormatMap map, IClassificationType[] rainbowTags) { this.view = textView; this.formatMap = map; this.rainbowTags = rainbowTags; layer = view.GetAdornmentLayer(LAYER); }
public AttachProcessVM(Dispatcher dispatcher, bool syntaxHighlight, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider) { this.dispatcher = dispatcher; processContext = new ProcessContext(classificationFormatMap, textElementProvider) { SyntaxHighlight = syntaxHighlight, }; processList = new ObservableCollection <ProcessVM>(); Refresh(); }
public QuickInfoSource( IClassificationFormatMapService classificationFormatMapService, HlslClassificationService classificationService, DispatcherGlyphService dispatcherGlyphService) { _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("text"); _tooltipClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip"); _classificationService = classificationService; _dispatcherGlyphService = dispatcherGlyphService; }
public TabsVM(IDocumentTabService documentTabService, ISaveService saveService, ITabsVMSettings tabsVMSettings, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider) { this.documentTabService = documentTabService; this.saveService = saveService; ClassificationFormatMap = classificationFormatMap; TextElementProvider = textElementProvider; Settings = tabsVMSettings; tabsList = new ObservableCollection<TabVM>(documentTabService.SortedTabs.Select(a => new TabVM(this, a))); SelectedItem = tabsList.Count == 0 ? null : tabsList[0]; InitializeSaveText(); }
public TaggedTextElementProvider(IContentType contentType, ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap) { if (contentType == null) throw new ArgumentNullException(nameof(contentType)); if (textClassifierAggregatorService == null) throw new ArgumentNullException(nameof(textClassifierAggregatorService)); if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); classifierAggregator = textClassifierAggregatorService.Create(contentType); this.classificationFormatMap = classificationFormatMap; }
OpenListCommand(IAppWindow appWindow, IDocumentListLoader documentListLoader, DocumentListService documentListService, IMessageBoxService messageBoxService, IDsDocumentService documentService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) { this.appWindow = appWindow; this.documentListLoader = documentListLoader; this.documentListService = documentListService; this.messageBoxService = messageBoxService; this.documentService = documentService; classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); this.textElementProvider = textElementProvider; }
AppSettingsService(IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider, IAppWindow appWindow, ITreeViewService treeViewService, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider, [ImportMany] IEnumerable<Lazy<IAppSettingsPageContainer, IAppSettingsPageContainerMetadata>> appSettingsPageContainers, [ImportMany] IEnumerable<Lazy<IAppSettingsPageProvider>> appSettingsPageProviders, [ImportMany] IEnumerable<Lazy<IAppSettingsModifiedListener, IAppSettingsModifiedListenerMetadata>> appSettingsModifiedListeners) { classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); this.textElementProvider = textElementProvider; this.appWindow = appWindow; this.treeViewService = treeViewService; this.treeViewNodeTextElementProvider = treeViewNodeTextElementProvider; this.appSettingsPageContainers = appSettingsPageContainers.OrderBy(a => a.Metadata.Order).ToArray(); this.appSettingsPageProviders = appSettingsPageProviders.ToArray(); this.appSettingsModifiedListeners = appSettingsModifiedListeners.OrderBy(a => a.Metadata.Order).ToArray(); }
public ExceptionContext(UIDispatcher uiDispatcher, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider, DbgExceptionSettingsService exceptionSettingsService, DbgExceptionFormatterService exceptionFormatterService, SearchMatcher searchMatcher) { UIDispatcher = uiDispatcher; ClassificationFormatMap = classificationFormatMap; TextElementProvider = textElementProvider; TextClassifierTextColorWriter = new TextClassifierTextColorWriter(); ExceptionSettingsService = exceptionSettingsService; ExceptionFormatterService = exceptionFormatterService; SearchMatcher = searchMatcher; }
public FormattedLineSource(ITextFormatterProvider textFormatterProvider, ITextParagraphPropertiesFactoryService textParagraphPropertiesFactoryService, ITextSnapshot sourceTextSnapshot, ITextSnapshot visualBufferSnapshot, int tabSize, double baseIndent, double wordWrapWidth, double maxAutoIndent, bool useDisplayMode, IClassifier aggregateClassifier, ITextAndAdornmentSequencer sequencer, IClassificationFormatMap classificationFormatMap, bool isViewWrapEnabled) { if (textFormatterProvider == null) { throw new ArgumentNullException(nameof(textFormatterProvider)); } if (sourceTextSnapshot == null) { throw new ArgumentNullException(nameof(sourceTextSnapshot)); } if (visualBufferSnapshot == null) { throw new ArgumentNullException(nameof(visualBufferSnapshot)); } if (aggregateClassifier == null) { throw new ArgumentNullException(nameof(aggregateClassifier)); } if (sequencer == null) { throw new ArgumentNullException(nameof(sequencer)); } if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (tabSize <= 0) { throw new ArgumentOutOfRangeException(nameof(tabSize)); } if (sourceTextSnapshot != visualBufferSnapshot) { throw new NotSupportedException("Text snapshot must be identical to visual snapshot"); } this.textFormatter = textFormatterProvider.Create(useDisplayMode); this.formattedTextCache = new FormattedTextCache(useDisplayMode); this.textParagraphPropertiesFactoryService = textParagraphPropertiesFactoryService; SourceTextSnapshot = sourceTextSnapshot; TopTextSnapshot = visualBufferSnapshot; UseDisplayMode = useDisplayMode; TabSize = tabSize; BaseIndentation = baseIndent; WordWrapWidth = wordWrapWidth; MaxAutoIndent = Math.Round(maxAutoIndent); ColumnWidth = formattedTextCache.GetColumnWidth(classificationFormatMap.DefaultTextProperties); this.wrapGlyphWidth = isViewWrapEnabled ? 1.5 * ColumnWidth : 0; LineHeight = WpfTextViewLine.DEFAULT_TOP_SPACE + WpfTextViewLine.DEFAULT_BOTTOM_SPACE + formattedTextCache.GetLineHeight(classificationFormatMap.DefaultTextProperties); TextHeightAboveBaseline = formattedTextCache.GetTextHeightAboveBaseline(classificationFormatMap.DefaultTextProperties); TextHeightBelowBaseline = formattedTextCache.GetTextHeightBelowBaseline(classificationFormatMap.DefaultTextProperties); TextAndAdornmentSequencer = sequencer; this.aggregateClassifier = aggregateClassifier; this.classificationFormatMap = classificationFormatMap; this.defaultTextParagraphProperties = new TextFormattingParagraphProperties(classificationFormatMap.DefaultTextProperties, ColumnWidth * TabSize); }
public CodeBreakpointContext(UIDispatcher uiDispatcher, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider, BreakpointConditionsFormatter breakpointConditionsFormatter, DbgCodeBreakpointHitCountService2 dbgCodeBreakpointHitCountService, SearchMatcher searchMatcher, CodeBreakpointFormatter formatter) { UIDispatcher = uiDispatcher; ClassificationFormatMap = classificationFormatMap; TextElementProvider = textElementProvider; TextClassifierTextColorWriter = new DbgTextClassifierTextColorWriter(); BreakpointConditionsFormatter = breakpointConditionsFormatter; DbgCodeBreakpointHitCountService = dbgCodeBreakpointHitCountService; SearchMatcher = searchMatcher; Formatter = formatter; }
public CodeToolTipWriter(IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService, bool syntaxHighlight) { if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); if (themeClassificationTypeService == null) throw new ArgumentNullException(nameof(themeClassificationTypeService)); this.classificationFormatMap = classificationFormatMap; this.themeClassificationTypeService = themeClassificationTypeService; this.syntaxHighlight = syntaxHighlight; result = new List<ColorAndText>(); sb = new StringBuilder(); }
AppSettingsService(IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider, IAppWindow appWindow, ITreeViewService treeViewService, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider, [ImportMany] IEnumerable <Lazy <IAppSettingsPageContainer, IAppSettingsPageContainerMetadata> > appSettingsPageContainers, [ImportMany] IEnumerable <Lazy <IAppSettingsPageProvider> > appSettingsPageProviders, [ImportMany] IEnumerable <Lazy <IAppSettingsModifiedListener, IAppSettingsModifiedListenerMetadata> > appSettingsModifiedListeners) { this.classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.OptionsDialog); this.textElementProvider = textElementProvider; this.appWindow = appWindow; this.treeViewService = treeViewService; this.treeViewNodeTextElementProvider = treeViewNodeTextElementProvider; this.appSettingsPageContainers = appSettingsPageContainers.OrderBy(a => a.Metadata.Order).ToArray(); this.appSettingsPageProviders = appSettingsPageProviders.ToArray(); this.appSettingsModifiedListeners = appSettingsModifiedListeners.OrderBy(a => a.Metadata.Order).ToArray(); }
public RainbowHighlight( IWpfTextView textView, RainbowHilightProvider provider ) { this.view = textView; this.provider = provider; this.formatMap = provider.GetFormatMap(textView); this.rainbowTags = provider.GetRainbowTags(); layer = view.GetAdornmentLayer(LAYER); }
public static Run ToRun(this SymbolDisplayPart part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var text = part.ToVisibleDisplayString(includeLeftToRightMarker: true); var run = new Run(text); var format = formatMap.GetTextProperties(typeMap.GetClassificationType(part.Kind.ToClassificationTypeName())); run.SetTextProperties(format); return run; }
public FormatMapWatcher(IWpfTextView view, IClassificationFormatMap formatMap, IClassificationTypeRegistryService typeRegistry) { this.formatMap = formatMap; this.text = typeRegistry.GetClassificationType("text"); this.typeRegistry = typeRegistry; this.FixComments(); this.formatMap.ClassificationFormatMappingChanged += FormatMapChanged; view.GotAggregateFocus += FirstGotFocus; view.VisualElement.IsVisibleChanged += delegate(object sender, DependencyPropertyChangedEventArgs args) { this.FixComments(); }; }
public QuickInfoContentCreator(IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService, ITextView textView) { if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); if (themeClassificationTypeService == null) throw new ArgumentNullException(nameof(themeClassificationTypeService)); if (textView == null) throw new ArgumentNullException(nameof(textView)); this.classificationFormatMap = classificationFormatMap; this.themeClassificationTypeService = themeClassificationTypeService; this.textView = textView; }
public FormatMapWatcher(ITextView view, IClassificationFormatMap formatMap, IClassificationTypeRegistryService typeRegistry) { this.formatMap = formatMap; this.text = typeRegistry.GetClassificationType("text"); this.typeRegistry = typeRegistry; this.FixComments(); this.formatMap.ClassificationFormatMappingChanged += FormatMapChanged; view.GotAggregateFocus += FirstGotFocus; }
private static void IncreaseServiceFormatPriority(IClassificationFormatMap formatMap, IClassificationTypeRegistryService registry, string formatName, IClassificationType highestPriorityType) { IClassificationType predefinedClassificationType = registry.GetClassificationType(formatName); IClassificationType artificialClassType = registry.CreateTransientClassificationType(predefinedClassificationType); TextFormattingRunProperties properties = formatMap.GetExplicitTextProperties(predefinedClassificationType); formatMap.AddExplicitTextProperties(artificialClassType, properties, highestPriorityType); formatMap.SwapPriorities(artificialClassType, predefinedClassificationType); formatMap.SwapPriorities(highestPriorityType, predefinedClassificationType); }
public TabsVM(IDocumentTabService documentTabService, ISaveService saveService, ITabsVMSettings tabsVMSettings, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider) { this.documentTabService = documentTabService; this.saveService = saveService; ClassificationFormatMap = classificationFormatMap; TextElementProvider = textElementProvider; Settings = tabsVMSettings; tabsList = new ObservableCollection <TabVM>(documentTabService.SortedTabs.Select(a => new TabVM(this, a))); SelectedItem = tabsList.Count == 0 ? null : tabsList[0]; InitializeSaveText(); }
public FormatMapWatcher(ITextView view, IClassificationFormatMap formatMap, IClassificationTypeRegistryService typeRegistry) { this.formatMap = formatMap; this.text = typeRegistry.GetClassificationType("text"); this.typeRegistry = typeRegistry; this.ClearUrlForegroundColor(); this.formatMap.ClassificationFormatMappingChanged += FormatMapChanged; view.GotAggregateFocus += FirstGotFocus; }
public void TextViewCreated(IWpfTextView view) { if (map == null) { map = formatMapService.GetClassificationFormatMap(view); } classificationService.SyncWithConfigs(); Decorate(); }
public HtmlMarkupProvider( IClassificationFormatMap classificationFormatMap, IClassificationType defaultClassificationType, Brush backgroundColor) { _classificationFormatMap = classificationFormatMap; _defaultClassificationType = defaultClassificationType; _defaultTextProperties = _classificationFormatMap.GetTextProperties(_defaultClassificationType); _defaultCss = GetCssStyles(_defaultClassificationType); _defaultCss["background"] = GetColor(backgroundColor); }
public FormatMapWatcher(ITextView view, IClassificationFormatMap formatMap, IClassificationTypeRegistryService typeRegistry) { this._formatMap = formatMap; this._text = typeRegistry.GetClassificationType("text"); this._typeRegistry = typeRegistry; this.FixComments(); this._formatMap.ClassificationFormatMappingChanged += FormatMapChanged; view.GotAggregateFocus += FirstGotFocus; }
public VisualStudioChangeSignatureOptionsService( IClassificationFormatMapService classificationFormatMapService, ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext ) : base(threadingContext) { _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap( "tooltip" ); _classificationTypeMap = classificationTypeMap; }
public static Run GetRun(TaggedText part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var text = GetVisibleDisplayString(part, includeLeftToRightMarker: true); var run = new Run(text); var format = formatMap.GetTextProperties(typeMap.GetClassificationType(ClassificationTags.GetClassificationTypeName(part.Tag))); run.SetTextProperties(format); return(run); }
public HtmlBuilder(IClassificationFormatMap classificationFormatMap, string delimiter, int tabSize) { if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); if (delimiter == null) throw new ArgumentNullException(nameof(delimiter)); if (tabSize < 1) throw new ArgumentOutOfRangeException(nameof(tabSize)); this.classificationFormatMap = classificationFormatMap; this.delimiter = delimiter; htmlWriter = new HtmlClipboardFormatWriter() { TabSize = tabSize }; cssWriter = new StringBuilder(); }
public void TextViewCreated(IWpfTextView textView) { IClassificationType classification = ClassificationRegistry.GetClassificationType(Constants.LINE_HIGHLIGHT); IClassificationFormatMap map = FormatMapService.GetClassificationFormatMap(textView); textView.Properties.GetOrCreateSingletonProperty( () => { return(new CurrentLineAdornment(textView, map, classification)); }); }
public static Run ToRun(this SymbolDisplayPart part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var text = part.ToVisibleDisplayString(includeLeftToRightMarker: true); var run = new Run(text); var format = formatMap.GetTextProperties(typeMap.GetClassificationType(part.Kind.ToClassificationTypeName())); run.SetTextProperties(format); return(run); }
public void TextViewCreated(IWpfTextView textView) { IClassificationType classification = ClassificationRegistry.GetClassificationType(Constants.COLUMN_HIGHLIGHT); IClassificationFormatMap map = FormatMapService.GetClassificationFormatMap(FontsAndColorsCategories.TextEditorCategory); textView.Properties.GetOrCreateSingletonProperty( () => { return(new CurrentColumnAdornment(textView, map, classification, Settings)); }); }
public static Run ToRun(this ClassifiedText part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var text = part.Text; var run = new Run(text); var format = formatMap.GetTextProperties(typeMap.GetClassificationType( part.ClassificationType)); run.SetTextProperties(format); return run; }
private CommentViewDecorator(ITextView view, IClassificationFormatMap map, IClassificationTypeRegistryService service) { view.GotAggregateFocus += TextView_GotAggregateFocus; SettingsStore.SettingsSaved += OnSettingsSaved; formatMap = map; regService = service; Decorate(); }
public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan) { ITextSnapshot snapshot = _buffer.CurrentSnapshot; ITrackingPoint triggerPoint = session.GetTriggerPoint(_buffer); SnapshotPoint point = triggerPoint.GetPoint(snapshot); SyntaxTree syntax = snapshot.GetSyntaxTree(); RobotsTxtDocumentSyntax root = syntax.Root as RobotsTxtDocumentSyntax; applicableToSpan = null; // find section RobotsTxtLineSyntax line = root.Records .SelectMany(r => r.Lines) .FirstOrDefault(s => s.NameToken.Span.Span.Contains(point)); if (line != null) { IClassificationFormatMap formatMap = _classificationFormatMapService.GetClassificationFormatMap(session.TextView); string fieldName = line.NameToken.Value; // get glyph var glyph = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupProperty, StandardGlyphItem.GlyphItemPublic); var classificationType = _classificationRegistry.GetClassificationType("RobotsTxt/RecordName"); var format = formatMap.GetTextProperties(classificationType); // construct content ISemanticModel model = syntax.GetSemanticModel(); var field = model.GetFieldSymbol(line); var content = new QuickInfoContent { Glyph = glyph, Signature = new Run(field.Name) { Foreground = format.ForegroundBrush }, Documentation = RobotsTxtDocumentation.GetDocumentation(field), }; // add to session quickInfoContent.Add( new ContentPresenter { Content = content, ContentTemplate = Template, } ); applicableToSpan = snapshot.CreateTrackingSpan(line.NameToken.Span.Span, SpanTrackingMode.EdgeInclusive); return; } }
Run ToRun(string text, SyntaxTokenClassification classification, IClassificationFormatMap formatMap) { var run = new Run(text); IClassificationType ct; _classificationMap.TryGetValue(classification, out ct); if (ct != null) { var props = formatMap.GetTextProperties(ct); run.SetTextProperties(props); } return run; }
public CommentViewDecorator(ITextView textView, IClassificationFormatMap formatMap, IClassificationTypeRegistryService registryService) { textView.GotAggregateFocus += TextView_GotAggregateFocus; FontSettingsManager.SettingsSaved += SettingsSaved; this.formatMap = formatMap; this.registryService = registryService; Decorate(); }
public TextViewChangeFormatter(ITextView textView, IViewTagAggregatorFactoryService tagAggregatorFactory, IClassificationFormatMapService classificationFormatMapService) { if (!textView.IsClosed) { _textView = textView; _classificationAggregator = tagAggregatorFactory.CreateTagAggregator <IClassificationTag>(_textView); _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(textView); _textView.Closed += OnTextViewClosed; textView.TextBuffer.PostChanged += OnTextBufferPostChanged; } }
public CompletionTextElementProvider(ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap, IContentTypeRegistryService contentTypeRegistryService) { if (textClassifierAggregatorService == null) throw new ArgumentNullException(nameof(textClassifierAggregatorService)); if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); if (contentTypeRegistryService == null) throw new ArgumentNullException(nameof(contentTypeRegistryService)); this.textClassifierAggregatorService = textClassifierAggregatorService; this.classificationFormatMap = classificationFormatMap; this.contentTypeRegistryService = contentTypeRegistryService; toClassifier = new Dictionary<IContentType, ITextClassifier>(); }
internal CommandMarginController(IVimBuffer buffer, FrameworkElement parentVisualElement, CommandMarginControl control, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap) { _vimBuffer = buffer; _margin = control; _parentVisualElement = parentVisualElement; _editorFormatMap = editorFormatMap; _classificationFormatMap = classificationFormatMap; Connect(); UpdateForRecordingChanged(); UpdateTextColor(); }
public static Run ToRun(this ClassifiedText part, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var run = new Run(part.Text); var classificationType = typeMap.GetClassificationType(part.ClassificationType); var format = formatMap.GetTextProperties(classificationType); run.SetTextProperties(format); return(run); }
public InlineParameterNameHintsTagger(InlineParameterNameHintsTaggerProvider taggerProvider, ITextView textView, ITextBuffer buffer, ITagAggregator <InlineParameterNameHintDataTag> tagAggregator) { _cache = new List <ITagSpan <IntraTextAdornmentTag> >(); _threadAffinitizedObject = new ForegroundThreadAffinitizedObject(taggerProvider.ThreadingContext); _textView = textView; _buffer = buffer; _tagAggregator = tagAggregator; _formatMap = taggerProvider.ClassificationFormatMapService.GetClassificationFormatMap(textView); _hintClassification = taggerProvider.ClassificationTypeRegistryService.GetClassificationType(InlineParameterNameHintsTag.TagId); _formatMap.ClassificationFormatMappingChanged += this.OnClassificationFormatMappingChanged; _tagAggregator.TagsChanged += OnTagAggregatorTagsChanged; }
public static IList <Inline> ToInlines( this IEnumerable <TaggedText> parts, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap) { var classifiedTexts = parts.Select(p => new ClassifiedText( p.Tag.ToClassificationTypeName(), p.ToVisibleDisplayString(includeLeftToRightMarker: true))); return(classifiedTexts.ToInlines(formatMap, typeMap)); }
/// <summary> /// Creates the UIElement on call /// Uses PositionAffinity.Predecessor because we want the tag to be associated with the preceding character /// </summary> /// <param name="textView">The view of the editor</param> /// <param name="span">The span that has the location of the hint</param> public static InlineHintsTag Create( InlineHint hint, TextFormattingRunProperties format, IWpfTextView textView, SnapshotSpan span, InlineHintsTaggerProvider taggerProvider, IClassificationFormatMap formatMap, bool classify) { return(new InlineHintsTag( CreateElement(hint.DisplayParts, textView, format, formatMap, taggerProvider.TypeMap, classify), textView, span, hint, taggerProvider)); }
public TaggedTextElementProvider(IContentType contentType, ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap) { if (contentType is null) { throw new ArgumentNullException(nameof(contentType)); } if (textClassifierAggregatorService is null) { throw new ArgumentNullException(nameof(textClassifierAggregatorService)); } classifierAggregator = textClassifierAggregatorService.Create(contentType); this.classificationFormatMap = classificationFormatMap ?? throw new ArgumentNullException(nameof(classificationFormatMap)); }
public HighlightLine(IWpfTextView view, IClassificationFormatMap formatMap, IClassificationType formatType) { m_view = view; m_layer = view.GetAdornmentLayer("CurrentLine"); m_formatMap = formatMap; m_formatType = formatType; // Listen to any event that changes the layout (text changes, scrolling, etc) m_view.LayoutChanged += DoLayoutChanged; m_view.ViewportWidthChanged += (s, e) => DoDraw(); m_view.ViewportLeftChanged += (s, e) => DoDraw(); m_view.Selection.SelectionChanged += (s, e) => DoDraw(); formatMap.ClassificationFormatMappingChanged += (s, e) => { m_fillBrush = null; DoReset(); }; }
public FormatMapWatcher(ITextView view, IClassificationFormatMap formatMap, IClassificationTypeRegistryService typeRegistry) { _view = view; _formatMap = formatMap; _typeRegistry = typeRegistry; FixComments(); //_formatMap.ClassificationFormatMappingChanged += FormatMapChanged; view.GotAggregateFocus += FirstGotFocus; view.Closed += view_Closed; }
public VisualsFactory(ITextView textView, IClassifier classifier, Double maxLineWidth) { _textView = textView; _classifier = classifier; _maxLineWidth = maxLineWidth; /* * DocumentType("text.xml") = XmlWordClassificationLookup * DocumentType("C#"), DocumentType("VB"), DocumentType("text") = ClassificationFormatMap * Else = DefaultClassificationFormatMap */ _classificationFormatMap = Connector.Assets.ClassificationFormatMapSelector.Invoke(_textView.TextBuffer.DocumentType); _paragraphProperties = new TextFormattingParagraphProperties(); }
internal EasyMotionAdornmentController(IEasyMotionUtil easyMotionUtil, IWpfTextView wpfTextview, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap) { _easyMotionUtil = easyMotionUtil; _wpfTextView = wpfTextview; _editorFormatMap = editorFormatMap; _classificationFormatMap = classificationFormatMap; if (_navigationKeysLong == null) { _navigationKeysLong = CreateNavigationKeysLong(); } if (_navigationKeysShort == null) { _navigationKeysShort = CreateNavigationKeysShort(); } }