public AsmDocMouseHandler( IWpfTextView view, IBufferTagAggregatorFactoryService aggregatorFactory, CtrlKeyState state, AsmDudeTools asmDudeTools) { AsmDudeToolsStatic.Output_INFO(string.Format("{0}:constructor: file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(view.TextBuffer))); this._view = view; this._state = state; this._aggregator2 = AsmDudeToolsStatic.GetOrCreate_Aggregator(view.TextBuffer, aggregatorFactory); this._asmDudeTools = asmDudeTools; this._state.CtrlKeyStateChanged += (sender, args) => { if (Settings.Default.AsmDoc_On) { if (this._state.Enabled) { this.TryHighlightItemUnderMouse(this.RelativeToView(Mouse.PrimaryDevice.GetPosition(this._view.VisualElement))); } else { this.Set_Highlight_Span(null); } } }; // Some other points to clear the highlight span: this._view.LostAggregateFocus += (sender, args) => this.Set_Highlight_Span(null); this._view.VisualElement.MouseLeave += (sender, args) => this.Set_Highlight_Span(null); }
#pragma warning restore SA1401 // Fields must be private /// <summary> /// Initializes a new instance of the <see cref="ProtobufClassifier"/> class. /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="aggregatorFactory">The aggregate factory.</param> /// <param name="typeService">The type service.</param> internal ProtobufClassifier(ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, IClassificationTypeRegistryService typeService) { Buffer = buffer; Aggregator = aggregatorFactory.CreateTagAggregator <ProtobufTokenTag>(buffer); Aggregator.TagsChanged += AggregatorTagsChanged; var outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; if (outputWindow != null) { outputWindow.CreatePane(ref outputPaneGuid, OutputWindowName, 1, 1); IVsOutputWindowPane myOutputPane; outputWindow.GetPane(ref outputPaneGuid, out myOutputPane); } // create mapping from token types to classification types ProtobufTypes = new Dictionary <CodeType, IClassificationType>(); ProtobufTypes[CodeType.Text] = typeService.GetClassificationType(ProtobufFormatDefinitions.Text); ProtobufTypes[CodeType.Keyword] = typeService.GetClassificationType(ProtobufFormatDefinitions.Keyword); ProtobufTypes[CodeType.Comment] = typeService.GetClassificationType(ProtobufFormatDefinitions.Comment); ProtobufTypes[CodeType.Identifier] = typeService.GetClassificationType(ProtobufFormatDefinitions.Identifier); ProtobufTypes[CodeType.String] = typeService.GetClassificationType(ProtobufFormatDefinitions.String); ProtobufTypes[CodeType.Number] = typeService.GetClassificationType(ProtobufFormatDefinitions.Number); ProtobufTypes[CodeType.Error] = typeService.GetClassificationType(ProtobufFormatDefinitions.Text); ProtobufTypes[CodeType.Enums] = typeService.GetClassificationType(ProtobufFormatDefinitions.Enum); ProtobufTypes[CodeType.SymDef] = typeService.GetClassificationType(ProtobufFormatDefinitions.SymDef); ProtobufTypes[CodeType.SymRef] = typeService.GetClassificationType(ProtobufFormatDefinitions.SymRef); ProtobufTypes[CodeType.FieldRule] = typeService.GetClassificationType(ProtobufFormatDefinitions.FieldRule); ProtobufTypes[CodeType.TopLevelCmd] = typeService.GetClassificationType(ProtobufFormatDefinitions.TopLevelCmd); ProtobufTypes[CodeType.Namespace] = typeService.GetClassificationType(ProtobufFormatDefinitions.Keyword); }
internal ClassificationTagger(ITextView view, ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, IClassificationTypeRegistryService registry) { _buffer = buffer; var options = view.Options; options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, true); options.SetOptionValue(DefaultOptions.IndentSizeOptionId, 2); options.SetOptionValue(DefaultOptions.TabSizeOptionId, 2); options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, true); _aggregator = aggregatorFactory.CreateTagAggregator <SchemeTag>(buffer); _schemeTokenTypes[Tokens.COMMENT] = registry.GetClassificationType(PredefinedClassificationTypeNames.Comment); _schemeTokenTypes[Tokens.CHARACTER] = registry.GetClassificationType(PredefinedClassificationTypeNames.Character); _schemeTokenTypes[Tokens.DIRECTIVE] = registry.GetClassificationType(PredefinedClassificationTypeNames.PreprocessorKeyword); _schemeTokenTypes[Tokens.LITERAL] = registry.GetClassificationType(PredefinedClassificationTypeNames.Number); _schemeTokenTypes[Tokens.NUMBER] = registry.GetClassificationType(PredefinedClassificationTypeNames.Number); _schemeTokenTypes[Tokens.STRING] = registry.GetClassificationType(PredefinedClassificationTypeNames.String); _schemeTokenTypes[Tokens.SYMBOL] = registry.GetClassificationType(PredefinedClassificationTypeNames.Identifier); _schemeTokenTypes[Tokens.MLSTRING] = registry.GetClassificationType(PredefinedClassificationTypeNames.String); syntax = registry.GetClassificationType(PredefinedClassificationTypeNames.Keyword); procedure = registry.GetClassificationType("line number"); record = registry.GetClassificationType("cppmacro"); _buffer.Properties["SchemeBindings"] = bindings; _aggregator.BatchedTagsChanged += _aggregator_BatchedTagsChanged; }
internal AsmQuickInfoController( ITextView textView, IList <ITextBuffer> subjectBuffers, IQuickInfoBroker quickInfoBroker, IBufferTagAggregatorFactoryService aggregatorFactory) { //AsmDudeToolsStatic.Output_INFO("AsmQuickInfoController:constructor: file=" + AsmDudeToolsStatic.GetFileName(textView.TextBuffer)); this._textView = textView; this._subjectBuffers = subjectBuffers; this._quickInfoBroker = quickInfoBroker; this._aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(textView.TextBuffer, aggregatorFactory); this._textView.MouseHover += this.OnTextViewMouseHover; /*this._textView.MouseHover += (o, e) => { * SnapshotPoint? point = GetMousePosition(new SnapshotPoint(this._textView.TextSnapshot, e.Position)); * if (point.HasValue) * { * ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position, PointTrackingMode.Positive); * if (!this._quickInfoBroker.IsQuickInfoActive(this._textView)) * { * this._quickInfoBroker.TriggerQuickInfo(this._textView, triggerPoint, false); * } * } * }; */ }
internal ClassifierAggregator(ITextBuffer textBuffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactory, IClassificationTypeRegistryService classificationTypeRegistry) { // Validate. if (textBuffer == null) { throw new ArgumentNullException(nameof(textBuffer)); } if (bufferTagAggregatorFactory == null) { throw new ArgumentNullException(nameof(bufferTagAggregatorFactory)); } if (classificationTypeRegistry == null) { throw new ArgumentNullException(nameof(classificationTypeRegistry)); } _textBuffer = textBuffer; _classificationTypeRegistry = classificationTypeRegistry; // Create a tag aggregator that maps by content type, so we don't map through projection buffers that aren't "projection" content type. _tagAggregator = bufferTagAggregatorFactory.CreateTagAggregator <IClassificationTag>(textBuffer, TagAggregatorOptions.MapByContentType) as IAccurateTagAggregator <IClassificationTag>; _tagAggregator.BatchedTagsChanged += OnBatchedTagsChanged; }
public LabelGraph( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, ErrorListProvider errorListProvider, ITextDocumentFactoryService docFactory, IContentType contentType) { //AsmDudeToolsStatic.Output(string.Format("INFO: LabelGraph: constructor: creating a label graph for {0}", AsmDudeToolsStatic.GetFileName(buffer))); this._buffer = buffer; this._aggregatorFactory = aggregatorFactory; this._errorListProvider = errorListProvider; this._docFactory = docFactory; this._contentType = contentType; this._filenames = new Dictionary <uint, string>(); this._usedAt = new Dictionary <string, IList <uint> >(); this._defAt = new Dictionary <string, IList <uint> >(); this._hasLabel = new HashSet <uint>(); this._hasDef = new HashSet <uint>(); this._thisFilename = AsmDudeToolsStatic.GetFileName(this._buffer); this._enabled = true; this._busy = false; this._waiting = false; this._scheduled = false; this._buffer.ChangedLowPriority += this.BufferChanged; this.reset_Delayed(); }
public PhpProjectionBuffer( IContentTypeRegistryService contentRegistry, IProjectionBufferFactoryService bufferFactory, IBufferTagAggregatorFactoryService bufferTagAggregatorFactory, ITextBuffer diskBuffer, IBufferGraphFactoryService bufferGraphFactory, IContentType contentType) { _diskBuffer = diskBuffer; _contentRegistry = contentRegistry; _contentType = contentType; _projBuffer = CreateProjectionBuffer(bufferFactory); _htmlBuffer = CreateHtmlBuffer(bufferFactory); _templateBuffer = CreateTemplateBuffer(bufferFactory); _bufferGraph = bufferGraphFactory.CreateBufferGraph(_projBuffer); _contentTypeTagger = bufferTagAggregatorFactory.CreateTagAggregator <ContentTypeTag>(_diskBuffer); _contentTypeTagger.TagsChanged += HandleContentTypeTagsChanged; IVsTextBuffer buffer; if (_diskBuffer.Properties.TryGetProperty <IVsTextBuffer>(typeof(IVsTextBuffer), out buffer)) { // keep the Venus HTML classifier happy - it wants to find a site via IVsTextBuffer _htmlBuffer.Properties.AddProperty(typeof(IVsTextBuffer), buffer); } HandleContentTypeTagsChanged(); }
internal void Initialize( IBufferTagAggregatorFactoryService aggregatorFactory, IClassificationTypeRegistryService service, IClassificationFormatMapService ClassificationFormatMapService) { try { if (initialized) { return; } var ffn = _buffer.GetFFN().Result; if (ffn == null) { return; } _grammar_description = LanguageServer.GrammarDescriptionFactory.Create(ffn); if (_grammar_description == null) { return; } var document = Workspaces.Workspace.Instance.FindDocument(ffn); if (document == null) { Workspaces.Loader.LoadAsync().Wait(); var to_do = LanguageServer.Module.Compile(); document = Workspaces.Workspace.Instance.FindDocument(ffn); } _aggregator = aggregatorFactory.CreateTagAggregator <AntlrTokenTag>(_buffer); _antlrtype_to_classifiertype = new Dictionary <int, IClassificationType>(); for (int i = 0; i < _grammar_description.Map.Length; ++i) { var key = i; var val = _grammar_description.Map[i]; var identiferClassificationType = service.GetClassificationType(val); var classificationType = identiferClassificationType == null?service.CreateClassificationType(val, new IClassificationType[] { }) : identiferClassificationType; var classificationFormatMap = ClassificationFormatMapService.GetClassificationFormatMap(category: "text"); var identifierProperties = classificationFormatMap .GetExplicitTextProperties(classificationType); var color = !Themes.IsInvertedTheme() ? _grammar_description.MapColor[key] : _grammar_description.MapInvertedColor[key]; System.Windows.Media.Color newColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); var newProperties = identifierProperties.SetForeground(newColor); classificationFormatMap.AddExplicitTextProperties(classificationType, newProperties); } for (int i = 0; i < _grammar_description.Map.Length; ++i) { var key = i; var val = _grammar_description.Map[i]; _antlrtype_to_classifiertype[key] = service.GetClassificationType(val); } initialized = true; } catch (Exception exception) { Logger.Log.Notify(exception.StackTrace); } }
internal XSharpFormattingCommandHandler(IVsTextView textViewAdapter, ITextView textView, IBufferTagAggregatorFactoryService aggregator) { this._textView = textView; this._textView.Closed += OnClosed; this._aggregator = aggregator; //add this to the filter chain _linesToSync = new List <int>(); // _buffer = _textView.TextBuffer; if (_buffer != null) { _buffer.ChangedLowPriority += Textbuffer_Changed; _buffer.Changing += Textbuffer_Changing; _file = _buffer.GetFile(); if (_buffer.CheckEditAccess()) { //formatCaseForWholeBuffer(); } } if (_file != null) { _settings = EditorConfigReader.ReadSettings(_buffer, _file.FullPath); } textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler); registerClassifier(); }
public ErrorTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, ITaggableBufferIndicator taggableBufferIndicator, IErrorTagTooltipProvider errorTagTooltipProvider) { this.bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService; this.taggableBufferIndicator = taggableBufferIndicator; this.errorTagTooltipProvider = errorTagTooltipProvider; }
internal LaconicClassifier( IClassificationTypeRegistryService typeService, ITextBufferFactoryService bufferFactory, IBufferTagAggregatorFactoryService tagAggregatorFactoryService, string docName) : base(typeService, bufferFactory, tagAggregatorFactoryService, docName) { }
public SelectedIssueLocationTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, IAnalysisIssueSelectionService issueSelectionService, ITaggableBufferIndicator taggableBufferIndicator) { this.bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService; this.issueSelectionService = issueSelectionService; this.taggableBufferIndicator = taggableBufferIndicator; }
public TokenCounter(ITextBuffer textBuffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, string tokenText) { _textBuffer = textBuffer; _classifierAggregator = bufferTagAggregatorFactoryService.CreateTagAggregator<IClassificationTag>(textBuffer); _tokenText = tokenText; _tree = new TokenCountTree(this, _textBuffer.CurrentSnapshot); _classifierAggregator.BatchedTagsChanged += HandleClassifierTagsChanged; }
public TokenCounter(ITextBuffer textBuffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, string tokenText) { _textBuffer = textBuffer; _classifierAggregator = bufferTagAggregatorFactoryService.CreateTagAggregator <IClassificationTag>(textBuffer); _tokenText = tokenText; _tree = new TokenCountTree(this, _textBuffer.CurrentSnapshot); _classifierAggregator.BatchedTagsChanged += HandleClassifierTagsChanged; }
public static ITagAggregator <AsmTokenTag> getAggregator( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory) { Func <ITagAggregator <AsmTokenTag> > sc = delegate() { return(aggregatorFactory.CreateTagAggregator <AsmTokenTag>(buffer)); }; return(buffer.Properties.GetOrCreateSingletonProperty(sc)); }
public IssueLocationActionsSourceProvider([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, IIssueSelectionService selectionService, ILightBulbBroker lightBulbBroker) { this.bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService; this.selectionService = selectionService; this.lightBulbBroker = lightBulbBroker; vsUiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; }
internal SquigglesTagger(ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory) { this._sourceBuffer = buffer; ITagAggregator <SLangTokenTag> sc() { return(aggregatorFactory.CreateTagAggregator <SLangTokenTag>(buffer)); } this._aggregator = buffer.Properties.GetOrCreateSingletonProperty(sc); }
internal XSharpCompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, ICompletionBroker completionBroker, IBufferTagAggregatorFactoryService aggregator) { this._textView = textView; this._completionBroker = completionBroker; this._completionSession = null; this._aggregator = aggregator; //add this to the filter chain textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler); }
internal KeywordMatchingTagger(ITextView view, IBufferTagAggregatorFactoryService aggregator) { _view = view; _buffer = view.TextBuffer; _tag = new TextMarkerTag("blue"); _aggregator = aggregator; _view.Caret.PositionChanged += CaretPositionChanged; _view.LayoutChanged += ViewLayoutChanged; _view.Closed += ViewClosed; }
internal NhtTagger( IClassificationTypeRegistryService typeService, ITextBufferFactoryService bufferFactory, IBufferTagAggregatorFactoryService tagAggregatorFactoryService, IContentTypeRegistryService contentTypeRegistryService, string docName) : base(typeService, bufferFactory, tagAggregatorFactoryService, docName) { m_CssContentType = contentTypeRegistryService.GetContentType("css"); m_JavaScripContentType = contentTypeRegistryService.GetContentType("JavaScript"); }
/// <summary>Factory return singleton</summary> public static AsmSimulator GetOrCreate_AsmSimulator( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory) { Func <AsmSimulator> sc = delegate() { return(new AsmSimulator(buffer, aggregatorFactory)); }; return(buffer.Properties.GetOrCreateSingletonProperty(sc)); }
public static ITagAggregator <AsmTokenTag> GetOrCreate_Aggregator( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory) { ITagAggregator <AsmTokenTag> sc() { // this is the only place where ITagAggregator are created //AsmDudeToolsStatic.Output_INFO("Creating a ITagAggregator"); return(aggregatorFactory.CreateTagAggregator <AsmTokenTag>(buffer)); } return(buffer.Properties.GetOrCreateSingletonProperty(sc)); }
public ErrorStatusTextViewCreationListener( IBufferTagAggregatorFactoryService tagAggregatorFactoryService, [ImportMany]IEnumerable<Lazy<ErrorTypeDefinition, IOrderable>> unorderedErrorTypeDefinitions, SVsServiceProvider serviceProvider) { this.TagAggregatorFactoryService = tagAggregatorFactoryService ?? throw new ArgumentNullException(nameof(tagAggregatorFactoryService)); this.UnorderedErrorTypeDefinition = unorderedErrorTypeDefinitions ?? throw new ArgumentNullException(nameof(unorderedErrorTypeDefinitions)); this.ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); }
public AsmQuickInfoSource( ITextBuffer textBuffer, IBufferTagAggregatorFactoryService aggregatorFactory, LabelGraph labelGraph, AsmSimulator asmSimulator) { this.textBuffer_ = textBuffer ?? throw new ArgumentNullException(nameof(textBuffer)); this.aggregator_ = AsmDudeToolsStatic.GetOrCreate_Aggregator(textBuffer, aggregatorFactory); this.labelGraph_ = labelGraph ?? throw new ArgumentNullException(nameof(labelGraph)); this.asmSimulator_ = asmSimulator ?? throw new ArgumentNullException(nameof(asmSimulator)); this.asmDudeTools_ = AsmDudeTools.Instance; }
public AsmQuickInfoSource( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, LabelGraph labelGraph, AsmSimulator asmSimulator) { this._sourceBuffer = buffer; this._aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, aggregatorFactory); this._labelGraph = labelGraph; this._asmSimulator = asmSimulator; this._asmDudeTools = AsmDudeTools.Instance; }
public XSharpCompletionSource(XSharpCompletionSourceProvider provider, ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregator, XFile file) { _provider = provider; _buffer = buffer; _file = file; var prj = _file.Project.ProjectNode; _dialect = _file.Project.Dialect; helpers = new CompletionHelpers(_dialect, provider.GlyphService, file, !prj.ParseOptions.CaseSensitive); this.aggregator = aggregator; }
public XSharpAsyncCompletionSource(XSharpAsyncCompletionSourceProvider provider, ITextView textView, IBufferTagAggregatorFactoryService aggregator, XFile file) { _provider = provider; _textView = textView; _buffer = textView.TextBuffer; _file = file; // Currently, set as default, but should be VS Settings Based // Retrieve from Project properties later: _file.Project.ProjectNode.ParseOptions. var prj = _file.Project.ProjectNode; _dialect = _file.Project.Dialect; this.aggregator = aggregator; }
internal AsmQuickInfoController( ITextView textView, IList <ITextBuffer> subjectBuffers, IQuickInfoBroker quickInfoBroker, IBufferTagAggregatorFactoryService aggregatorFactory) { AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:constructor; file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(textView.TextBuffer))); this.textView_ = textView ?? throw new ArgumentNullException(nameof(textView)); this.subjectBuffers_ = subjectBuffers ?? throw new ArgumentNullException(nameof(subjectBuffers)); this.quickInfoBroker_ = quickInfoBroker ?? throw new ArgumentNullException(nameof(quickInfoBroker)); this.aggregator_ = AsmDudeToolsStatic.GetOrCreate_Aggregator(textView.TextBuffer, aggregatorFactory); this.textView_.MouseHover += this.OnTextViewMouseHover; }
public static ILabelGraph getLabelGraph( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, ITextDocumentFactoryService docFactory, IContentTypeRegistryService contentService) { Func <LabelGraph> sc1 = delegate() { IContentType contentType = contentService.GetContentType(AsmDudePackage.AsmDudeContentType); return(new LabelGraph(buffer, aggregatorFactory, AsmDudeTools.Instance.errorListProvider, docFactory, contentType)); }; return(buffer.Properties.GetOrCreateSingletonProperty(sc1)); }
public ErrorTagger(ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, IServiceProvider svcp, ITextDocumentFactoryService textDocumentFactory, ITextView view) { _buffer = buffer; _view = view; _aggregator = aggregatorFactory.CreateTagAggregator <SchemeTag>(buffer); textDocumentFactory.TryGetTextDocument(_buffer, out _document); _errorProvider = new ErrorListProvider(svcp); BufferIdleEventUtil.AddBufferIdleEventListener(_buffer, ReparseFile); }
public static LabelGraph GetOrCreate_Label_Graph( ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, ITextDocumentFactoryService docFactory, IContentTypeRegistryService contentService) { LabelGraph sc1() { IContentType contentType = contentService.GetContentType(AsmDudePackage.AsmDudeContentType); return(new LabelGraph(buffer, aggregatorFactory, AsmDudeTools.Instance.Error_List_Provider, docFactory, contentType)); } return(buffer.Properties.GetOrCreateSingletonProperty(sc1)); }
public UnderlineClassifierProvider(IClassificationTypeRegistryService classificationTypeRegistryService, IBufferTagAggregatorFactoryService aggregatorFactory) { _classificationTypeRegistryService = classificationTypeRegistryService; _aggregatorFactory = aggregatorFactory; }
public EmojiLocationHandler(ITextBuffer buffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService) { _classificationTagAggregator = bufferTagAggregatorFactoryService.CreateTagAggregator<IClassificationTag>(buffer); }
public EmojiLocationHandlerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService) { _bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService; }