Пример #1
0
        public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
        {
            var classificationFormatMap = ClassificationFormatMapService.GetClassificationFormatMap(@"text");
            var editorFormatMap         = EditorFormatMapService.GetEditorFormatMap(@"text");

            return(new NQueryQuickInfoSource(classificationFormatMap, editorFormatMap, ClassificationService));
        }
Пример #2
0
 public TextViewClassificationFormatMap(ClassificationFormatMapService classificationFormatMapService, ITextView textView)
     : base(classificationFormatMapService, DefaultWpfViewOptions.AppearanceCategoryName)
 {
     this.textView = textView ?? throw new ArgumentNullException(nameof(textView));
     textView.Options.OptionChanged += Options_OptionChanged;
     Initialize();
 }
Пример #3
0
        private void ApplyDefaultSettings()
        {
            var textFormatMap = ClassificationFormatMapService.GetClassificationFormatMap("text");

            textFormatMap.DefaultTextProperties = textFormatMap.DefaultTextProperties.SetFontRenderingEmSize(11);
            textFormatMap.DefaultTextProperties = textFormatMap.DefaultTextProperties.SetTypeface(new Typeface("Consolas"));
        }
Пример #4
0
        public void OnImportsSatisfied()
        {
            // Set default editor settings

            var classificationFormatMap = ClassificationFormatMapService.GetClassificationFormatMap("text");

            classificationFormatMap.DefaultTextProperties = classificationFormatMap.DefaultTextProperties
                                                            .SetFontRenderingEmSize(13.3333333333333333)
                                                            .SetTypeface(new Typeface("Consolas"));
        }
Пример #5
0
        protected void RefreshClassifications()
        {
            // read color settings from VSCommands category and apply them to classification types

            const uint flags = (uint)(
                __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_PROPAGATECHANGES);

            try
            {
                var x = FontAndColorStorageService.OpenCategory(new Guid("{b0e6a221-92fd-4d72-be80-04a36b591fcb}"), flags);
                foreach (var item in ClassificationTypesMatchPatterns)
                {
                    try
                    {
                        if (FontAndColorStorageService.GetItem(item.ClassificationTypeName, item.ColorableItemInfos) < 0)
                        {
                            // Logger.TraceDiagnosticWarning(() => "Unable to load classification data for {0}".FormatWith(item.ClassificationTypeName));
                            continue;
                        }

                        var ct = ClassificationTypeRegistryService.GetClassificationType(item.ClassificationTypeName);

                        var fm = ClassificationFormatMapService.GetClassificationFormatMap(ClassificationMapName);

                        var currentTp = fm.GetTextProperties(ct);

                        var tp = currentTp.SetForeground(item.ColorableItemInfos[0].GetForeground());

                        tp = tp.SetBackground(item.ColorableItemInfos[0].GetBackground());

                        var fontFlags = (FONTFLAGS)item.ColorableItemInfos[0].dwFontFlags;

                        if (fontFlags.IsFlagSet(FONTFLAGS.FF_BOLD))
                        {
                            tp = tp.SetBold(true);
                        }
                        else
                        {
                            tp = tp.SetBold(false);
                        }

                        fm.SetTextProperties(ct, tp);
                    }
                    catch (Exception ex)
                    {
                        // TODO: logging
                        // Logger.LogException(ex);
                    }
                }

                FontAndColorStorageService.CloseCategory();
            }
            catch (Exception ex)
            {
                // TODO: logging
            }
            finally
            {
                FontAndColorStorageService.CloseCategory();
            }
        }