public HostFactory( IVim vim, IVsEditorAdaptersFactoryService adaptersFactory, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, ITextManager textManager, IVsAdapter adapter, IVimProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IEditorToSettingsSynchronizer editorToSettingSynchronizer, [ImportMany] IEnumerable <Lazy <ICommandTargetFactory, IOrderable> > commandTargetFactoryList) { _vim = vim; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _textManager = textManager; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; _editorToSettingSynchronizer = editorToSettingSynchronizer; _commandTargetFactoryList = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection(); #if DEBUG VimTrace.TraceSwitch.Level = TraceLevel.Info; #endif }
CompletionBroker(IImageManager imageManager, Lazy <IIntellisenseSessionStackMapService> intellisenseSessionStackMapService, Lazy <ICompletionTextElementProviderService> completionTextElementProviderService, [ImportMany] IEnumerable <Lazy <ICompletionSourceProvider, IOrderableContentTypeMetadata> > completionSourceProviders) { this.imageManager = imageManager; this.intellisenseSessionStackMapService = intellisenseSessionStackMapService; this.completionTextElementProviderService = completionTextElementProviderService; this.completionSourceProviders = Orderer.Order(completionSourceProviders).ToArray(); }
public static IEnumerable <Lazy <TComponent, TMetadata> > ImportMany(ICompositionService compositionService) { var importer = new ManyImporter(); compositionService.SatisfyImportsOnce(importer); return(Orderer.Order(importer.Imports)); }
CompletionBroker(Lazy <IIntellisenseSessionStackMapService> intellisenseSessionStackMapService, Lazy <IIntellisensePresenterFactoryService> intellisensePresenterFactoryService, Lazy <ICurrentLineSpaceReservationService> currentLineSpaceReservationService, [ImportMany] IEnumerable <Lazy <ICompletionSourceProvider, IOrderableContentTypeMetadata> > completionSourceProviders) { this.intellisenseSessionStackMapService = intellisenseSessionStackMapService; this.intellisensePresenterFactoryService = intellisensePresenterFactoryService; this.currentLineSpaceReservationService = currentLineSpaceReservationService; this.completionSourceProviders = Orderer.Order(completionSourceProviders).ToArray(); }
GlyphTextMarkerService(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphTextMarkerMouseProcessorProvider, IGlyphTextMarkerMouseProcessorProviderMetadata> > glyphTextMarkerMouseProcessorProviders) { ViewTagAggregatorFactoryService = viewTagAggregatorFactoryService; EditorFormatMapService = editorFormatMapService; glyphTextMarkers = new HashSet <IGlyphTextMarkerImpl>(); GlyphTextMarkerMouseProcessorProviders = Orderer.Order(glyphTextMarkerMouseProcessorProviders).ToArray(); }
EditorFormatDefinitionService([ImportMany] IEnumerable <Lazy <EditorFormatDefinition, IEditorFormatMetadata> > editorFormatDefinitions, [ImportMany] IEnumerable <Lazy <EditorFormatDefinition, IClassificationFormatMetadata> > classificationFormatDefinitions) { EditorFormatDefinitions = editorFormatDefinitions.Where(a => Filter(a.Metadata.Name)).ToArray(); ClassificationFormatDefinitions = Orderer.Order(classificationFormatDefinitions).Where(a => Filter(((IEditorFormatMetadata)a.Metadata).Name)).ToArray(); toLazy = new Dictionary <string, Lazy <EditorFormatDefinition, IEditorFormatMetadata> >(StringComparer.OrdinalIgnoreCase); foreach (var e in EditorFormatDefinitions) { var name = e.Metadata.Name; if (toLazy.TryGetValue(name, out var lz)) { if (e.Metadata.Priority > lz.Metadata.Priority) { toLazy[name] = e; } else { Debug.Assert(e.Metadata.Priority < lz.Metadata.Priority); } } else { toLazy.Add(name, e); } } }
public UIElement GetUIElement(CompletionSet itemToRender, ICompletionSession context, UIElementType elementType) { var orderedProviders = Orderer.Order(UnOrderedCompletionSetUIElementProviders); foreach (var presenterProviderExport in orderedProviders) { foreach (var contentType in presenterProviderExport.Metadata.ContentTypes) { if (VSGeneroPackage.Instance.ContentType.IsOfType(contentType)) { if (presenterProviderExport.Value.GetType() == typeof(CompletionUIElementProvider)) { // don't forward to ourselves... continue; } var res = presenterProviderExport.Value.GetUIElement(itemToRender, context, elementType); if (res != null) { if (_isPreSp1) { return(res); } return(new CompletionControl(res, context)); } } } } return(null); }
SignatureHelpBroker(Lazy <IIntellisenseSessionStackMapService> intellisenseSessionStackMapService, [ImportMany] IEnumerable <Lazy <ISignatureHelpSourceProvider, IOrderableContentTypeMetadata> > signatureHelpSourceProviders, ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, IClassifierAggregatorService classifierAggregatorService, IClassificationFormatMapService classificationFormatMapService) { this.intellisenseSessionStackMapService = intellisenseSessionStackMapService; this.signatureHelpSourceProviders = Orderer.Order(signatureHelpSourceProviders).ToArray(); this.textBufferFactoryService = textBufferFactoryService; this.contentTypeRegistryService = contentTypeRegistryService; this.classifierAggregatorService = classifierAggregatorService; this.classificationFormatMapService = classificationFormatMapService; }
GlyphMarginProvider(IMenuService menuService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata> > glyphMouseProcessorProviders, [ImportMany] IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService) { this.menuService = menuService; this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; this.editorFormatMapService = editorFormatMapService; this.glyphMouseProcessorProviders = Orderer.Order(glyphMouseProcessorProviders).ToArray(); this.glyphFactoryProviders = Orderer.Order(glyphFactoryProviders).ToArray(); this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService; }
public DocumentMarkMarginProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, [ImportMany] IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders) { _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; // only get _our_ glyph factory _glyphFactoryProviders = Orderer.Order(glyphFactoryProviders) .Where(_ => _.Metadata.Name == PredefinedCodestreamNames.DocumentMarkGlyphFactoryProvider).ToArray(); }
GlyphTextMarkerService(IModuleIdProvider moduleIdProvider, IThemeService themeService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphTextMarkerMouseProcessorProvider, IGlyphTextMarkerMouseProcessorProviderMetadata> > glyphTextMarkerMouseProcessorProviders) { this.moduleIdProvider = moduleIdProvider; ThemeService = themeService; ViewTagAggregatorFactoryService = viewTagAggregatorFactoryService; EditorFormatMapService = editorFormatMapService; this.glyphTextMarkers = new HashSet <IGlyphTextMarkerImpl>(); this.GlyphTextMarkerMouseProcessorProviders = Orderer.Order(glyphTextMarkerMouseProcessorProviders).ToArray(); }
public TextViewMouseProcessorCollection(IWpfTextView wpfTextView, Lazy <IMouseProcessorProvider, IOrderableContentTypeAndTextViewRoleMetadata>[] mouseProcessorProviders, IEditorOperationsFactoryService editorOperationsFactoryService) { this.wpfTextView = wpfTextView; this.dsWpfTextView = wpfTextView as IDsWpfTextViewImpl; this.mouseProcessorProviders = Orderer.Order(mouseProcessorProviders).ToArray(); this.editorOperationsFactoryService = editorOperationsFactoryService; this.allowEventDelegate = AllowMouseEvent; wpfTextView.Closed += WpfTextView_Closed; wpfTextView.TextDataModel.ContentTypeChanged += TextDataModel_ContentTypeChanged; Reinitialize(); }
private void EnsureInitialized() { if (TextBufferToViewData == null) { TextBufferToViewData = new Dictionary <ITextBuffer, TextViewData>(); Shell.Terminating += OnTerminateApp; TextBufferListeners = Orderer.Order(TextBufferListeners); _bufferToOriginalContentType = new Dictionary <ITextBuffer, IContentType>(); } }
EditorFormatDefinitionService([ImportMany] IEnumerable <Lazy <EditorFormatDefinition, IEditorFormatMetadata> > editorFormatDefinitions, [ImportMany] IEnumerable <Lazy <EditorFormatDefinition, IClassificationFormatMetadata> > classificationFormatDefinitions) { EditorFormatDefinitions = editorFormatDefinitions.Where(a => Filter(a.Metadata.Name)).ToArray(); ClassificationFormatDefinitions = Orderer.Order(classificationFormatDefinitions).Where(a => Filter(((IEditorFormatMetadata)a.Metadata).Name)).ToArray(); toLazy = new Dictionary <string, Lazy <EditorFormatDefinition, IEditorFormatMetadata> >(StringComparer.OrdinalIgnoreCase); foreach (var e in EditorFormatDefinitions) { var name = e.Metadata.Name; if (!toLazy.ContainsKey(name)) { toLazy.Add(name, e); } } }
public NuGetProjectFactory( [ImportMany(typeof(IProjectSystemProvider))] IEnumerable <Lazy <IProjectSystemProvider, IOrderable> > providers) { if (providers == null) { throw new ArgumentNullException(nameof(providers)); } _providers = Orderer .Order(providers) .Select(p => p.Value) .ToArray(); }
public void OnImportsSatisfied() { try { var lazyFActory = Orderer.Order(_unOrderedTelemetrySessionFactoryExports).FirstOrDefault(); if (lazyFActory != null) { _telemetrySessionFactory = lazyFActory.Value; } } catch { Debug.Fail("Failed to instantiate ITelemetrySessionFactory."); } }
private void AddAllTables(AddOptions options) { var project = _ProjectManager.LoadFromFile(options.Project); var orderer = new Orderer <TableDescription>(tableDescription => tableDescription.ForeignKeyDescriptions.Select(foreignKeyDescription => foreignKeyDescription.Referenced)); var ordered = orderer.Order(project.Descriptor.TableDescriptions); foreach (var tableDescription in ordered.Select(_ => _.Node)) { var tablePrescription = CreateDefaultTablePrescription(project, tableDescription); if (tablePrescription.ColumnPrescriptions.Count > 0) { project.Prescriptor.AddTable(tablePrescription); } } _ProjectManager.SaveToFile(project, options.Project); }
public static List <IVsPackageManagerProvider> Sort( IEnumerable <Lazy <IVsPackageManagerProvider, IOrderable> > packageManagerProviders, int max) { var sortedProviders = new List <IVsPackageManagerProvider>(); var uniqueId = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var provider in Orderer.Order(packageManagerProviders)) { if (sortedProviders.Count < max && !uniqueId.Contains(provider.Value.PackageManagerId)) { uniqueId.Add(provider.Value.PackageManagerId); sortedProviders.Add(provider.Value); } } return(sortedProviders); }
public KeyProcessorCollection(IWpfTextView wpfTextView, Lazy <IKeyProcessorProvider, IOrderableContentTypeAndTextViewRoleMetadata>[] keyProcessorProviders) { this.wpfTextView = wpfTextView; this.keyProcessorProviders = Orderer.Order(keyProcessorProviders).ToArray(); this.keyProcessors = Array.Empty <KeyProcessor>(); wpfTextView.Closed += WpfTextView_Closed; wpfTextView.TextDataModel.ContentTypeChanged += TextDataModel_ContentTypeChanged; wpfTextView.VisualElement.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(VisualElement_KeyDown), true); wpfTextView.VisualElement.AddHandler(UIElement.KeyUpEvent, new KeyEventHandler(VisualElement_KeyUp), true); wpfTextView.VisualElement.AddHandler(UIElement.PreviewKeyDownEvent, new KeyEventHandler(VisualElement_PreviewKeyDown), true); wpfTextView.VisualElement.AddHandler(UIElement.PreviewKeyUpEvent, new KeyEventHandler(VisualElement_PreviewKeyUp), true); wpfTextView.VisualElement.AddHandler(UIElement.TextInputEvent, new TextCompositionEventHandler(VisualElement_TextInput), true); wpfTextView.VisualElement.AddHandler(UIElement.PreviewTextInputEvent, new TextCompositionEventHandler(VisualElement_PreviewTextInput), true); wpfTextView.VisualElement.AddHandler(TextCompositionManager.TextInputStartEvent, new TextCompositionEventHandler(VisualElement_TextInputStart), true); wpfTextView.VisualElement.AddHandler(TextCompositionManager.PreviewTextInputStartEvent, new TextCompositionEventHandler(VisualElement_PreviewTextInputStart), true); wpfTextView.VisualElement.AddHandler(TextCompositionManager.TextInputUpdateEvent, new TextCompositionEventHandler(VisualElement_TextInputUpdate), true); wpfTextView.VisualElement.AddHandler(TextCompositionManager.PreviewTextInputUpdateEvent, new TextCompositionEventHandler(VisualElement_PreviewTextInputUpdate), true); Reinitialize(); }
protected TextViewConnectionListener(IServiceContainer services) { Services = services; var ep = services.GetService <ExportProvider>(); _textBufferListeners = Orderer.Order(ep.GetExports <ITextBufferListener, IOrderedComponentContentTypes>()); _textViewListeners = ep.GetExports <ITextViewListener, IOrderedComponentContentTypes>(); _textViewListeners = ep.GetExports <ITextViewListener, IOrderedComponentContentTypes>(); _tdfs = services.GetService <ITextDocumentFactoryService>(); _allInstances = _allInstances ?? new List <TextViewConnectionListener>(); // This class is never disposed, so it always stays in the global list _allInstances.Add(this); _idleTime = services.GetService <IIdleTimeService>(); _application = services.GetService <IApplication>(); _application.Terminating += OnTerminateApp; }
public NuGetProjectFactory( [ImportMany(typeof(INuGetProjectProvider))] IEnumerable <Lazy <INuGetProjectProvider, IOrderable> > providers, [Import] IVsProjectThreadingService threadingService, [Import("VisualStudioActivityLogger")] Common.ILogger logger) { Assumes.Present(providers); Assumes.Present(threadingService); Assumes.Present(logger); _providers = Orderer .Order(providers) .Select(p => p.Value) .ToArray(); _threadingService = threadingService; _logger = logger; }
public UIElement GetUIElement(CompletionSet itemToRender, ICompletionSession context, UIElementType elementType) { if (_gettingUIElement) { return(null); } _gettingUIElement = true; try { var orderedProviders = Orderer.Order(UnOrderedCompletionSetUIElementProviders); var pyContentType = _serviceProvider.GetPythonContentType(); foreach (var presenterProviderExport in orderedProviders) { foreach (var contentType in presenterProviderExport.Metadata.ContentTypes) { if (pyContentType.IsOfType(contentType)) { if (presenterProviderExport.Value.GetType() == typeof(CompletionUIElementProvider)) { // don't forward to ourselves... continue; } var res = presenterProviderExport.Value.GetUIElement(itemToRender, context, elementType); if (res != null) { if (_isPreSp1) { return(res); } return(new CompletionControl(_serviceProvider, res, context)); } } } } return(null); } finally { _gettingUIElement = false; } }
public HostFactory( IVim vim, IVsEditorAdaptersFactoryService adaptersFactory, IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService, ITextManager textManager, IVsAdapter adapter, IProtectedOperations protectedOperations, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IEditorToSettingsSynchronizer editorToSettingSynchronizer, IVimApplicationSettings vimApplicationSettings, [ImportMany] IEnumerable <Lazy <ICommandTargetFactory, IOrderable> > commandTargetFactoryList) { _vim = vim; _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService; _adaptersFactory = adaptersFactory; _textManager = textManager; _adapter = adapter; _protectedOperations = protectedOperations; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; _editorToSettingSynchronizer = editorToSettingSynchronizer; _vimApplicationSettings = vimApplicationSettings; _commandTargetFactoryList = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection(); #if DEBUG VimTrace.TraceSwitch.Level = TraceLevel.Verbose; #endif // Make sure that for this _editorToSettingSynchronizer.SyncSetting(SettingSyncData.Create( DefaultWpfViewOptions.EnableHighlightCurrentLineId, WindowSettingNames.CursorLineName, false, x => SettingValue.NewToggle(x), s => s.GetToggle())); }
IntellisensePresenterFactoryService([ImportMany] IEnumerable <Lazy <IIntellisensePresenterProvider, IOrderableContentTypeMetadata> > intellisensePresenterProviders) { this.intellisensePresenterProviders = Orderer.Order(intellisensePresenterProviders).ToArray(); }
CompletionPresenterProvider(Lazy <ICompletionTextElementProviderService> completionTextElementProviderService, [ImportMany] IEnumerable <Lazy <IUIElementProvider <Completion, ICompletionSession>, IOrderableContentTypeMetadata> > completionUIElementProviders) { this.completionTextElementProviderService = completionTextElementProviderService; this.completionUIElementProviders = Orderer.Order(completionUIElementProviders).ToArray(); }
public void OnImportsSatisfied() { OrderedKeyProcessorProviders = Orderer.Order(KeyProcessorProviders); }
public void OnImportsSatisfied() { IList <Lazy <SpaceReservationManagerDefinition, IOrderable> > orderedManagers = Orderer.Order(_spaceReservationManagerDefinitions); for (int i = 0; (i < orderedManagers.Count); ++i) { this.OrderedSpaceReservationManagerDefinitions.Add(orderedManagers[i].Metadata.Name, i); } }
KeyboardWpfTextViewCreationListener([ImportMany] IEnumerable <Lazy <IKeyProcessorProvider, IOrderableContentTypeAndTextViewRoleMetadata> > keyProcessorProviders) { this.keyProcessorProviders = Orderer.Order(keyProcessorProviders).ToArray(); }
public static IEnumerable <Lazy <TComponent> > ImportMany(ICompositionService compositionService, IContentType contentType) { var components = ComponentLocatorForContentType <TComponent, IOrderedComponentContentTypes> .ImportMany(compositionService, contentType); return(Orderer.Order(components)); }
AdornmentLayerDefinitionService([ImportMany] IEnumerable <Lazy <AdornmentLayerDefinition, IAdornmentLayersMetadata> > adornmentLayerDefinitions) { this.adornmentLayerDefinitions = Orderer.Order(adornmentLayerDefinitions).ToArray(); }