public TemplateCompletionHandlerProvider(
            ITemplateEditorOptions options,
            IVsEditorAdaptersFactoryService editorAdapterFactory,
            Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider,
            ICompletionBroker completionBroker)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (editorAdapterFactory == null)
            {
                throw new ArgumentNullException(nameof(editorAdapterFactory));
            }

            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            this.options = options;
            this.editorAdapterFactory = editorAdapterFactory;
            this.serviceProvider      = serviceProvider;
            this.completionBroker     = completionBroker;
        }
Exemplo n.º 2
0
        private static void Show(Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider, EnvDTE.Project project)
        {
            var shell = serviceProvider.GetService(typeof(SVsShell)) as IVsShell;

            if (shell != null)
            {
                // Get the main window handle to host our InfoBar
                shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var obj);
                var host = (IVsInfoBarHost)obj;

                //If we cannot find the handle, we cannot do much, so return.
                if (host == null)
                {
                    return;
                }

                InfoBarModel infoBarModel = CreateInfoBarModel(project);

                //Get the factory object from IVsInfoBarUIFactory, create it and add it to host.
                var factory = serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) as IVsInfoBarUIFactory;
                IVsInfoBarUIElement element = factory.CreateInfoBar(infoBarModel);

                var infoBarEventsHandler = new InfoBarEventsHandler(serviceProvider, project);

                element.Advise(infoBarEventsHandler, out var _cookie);
                host.AddInfoBar(element);
            }
        }
Exemplo n.º 3
0
        private static IPackageSearchRemoteControlService CreateRemoteControlService(VSShell.SVsServiceProvider serviceProvider)
        {
            var vsService = serviceProvider.GetService(typeof(SVsRemoteControlService));

            if (vsService == null)
            {
                // If we can't access the file update service, then there's nothing we can do.
                return(null);
            }

            return(new RemoteControlService(vsService));
        }
        public VisualStudioSymbolSearchService(
            VisualStudioWorkspaceImpl workspace,
            VSShell.SVsServiceProvider serviceProvider)
            : base(workspace, SymbolSearchOptions.Enabled,
                   SymbolSearchOptions.SuggestForTypesInReferenceAssemblies,
                   SymbolSearchOptions.SuggestForTypesInNuGetPackages)
        {
            _workspace              = workspace;
            _installerService       = workspace.Services.GetService <IPackageInstallerService>();
            _localSettingsDirectory = new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings);

            _logService = new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog)));
        }
Exemplo n.º 5
0
        public static async void ShowAsync(Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider, EnvDTE.Project project)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                Show(serviceProvider, project);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.Write(ex);
            }
        }
Exemplo n.º 6
0
 public PackageSearchService(VSShell.SVsServiceProvider serviceProvider, IPackageInstallerService installerService)
     : this(installerService,
            CreateRemoteControlService(serviceProvider),
            new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog))),
            new DelayService(),
            new IOService(),
            new PatchService(),
            new DatabaseFactoryService(),
            new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings),
            // Report all exceptions we encounter, but don't crash on them.
            FatalError.ReportWithoutCrash,
            new CancellationTokenSource())
 {
     installerService.PackageSourcesChanged += OnPackageSourcesChanged;
     OnPackageSourcesChanged(this, EventArgs.Empty);
 }
        private StreamingFindUsagesPresenter(
            IMSBuildEditorHost host,
            Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider,
            IEditorFormatMapService formatMapService,
            IClassificationFormatMapService classificationFormatMapService,
            IClassificationTypeRegistryService classificationTypeRegistry,
            IEnumerable <ITableColumnDefinition> columns)
        {
            Host                       = host;
            _serviceProvider           = serviceProvider;
            FormatMapService           = formatMapService;
            ClassificationFormatMap    = classificationFormatMapService.GetClassificationFormatMap("tooltip");
            ClassificationTypeRegistry = classificationTypeRegistry;

            _vsFindAllReferencesService = serviceProvider.GetService <SVsFindAllReferences, IFindAllReferencesService> (true);
            _customColumns = columns.OfType <AbstractFindUsagesCustomColumnDefinition> ().ToImmutableArray();
        }
Exemplo n.º 8
0
 public SymbolSearchService(
     VisualStudioWorkspaceImpl workspace,
     VSShell.SVsServiceProvider serviceProvider)
     : this(workspace,
            workspace.Services.GetService <IPackageInstallerService>(),
            CreateRemoteControlService(serviceProvider),
            new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog))),
            new DelayService(),
            new IOService(),
            new PatchService(),
            new DatabaseFactoryService(),
            new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings),
            // Report all exceptions we encounter, but don't crash on them.
            FatalError.ReportWithoutCrash,
            new CancellationTokenSource())
 {
 }
Exemplo n.º 9
0
 public VisualStudioSymbolSearchProgressService(VSShell.SVsServiceProvider serviceProvider)
 {
     _taskCenterServiceOpt = new Lazy <IVsTaskStatusCenterService>(() =>
                                                                   (IVsTaskStatusCenterService)serviceProvider.GetService(typeof(SVsTaskStatusCenterService)));
 }
 public SymbolSearchServiceFactory(
     VSShell.SVsServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Exemplo n.º 11
0
 public PackageSearchServiceFactory(
     VSShell.SVsServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Exemplo n.º 12
0
 public SymbolSearchServiceFactory(
     VSShell.SVsServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
 public PackageSearchServiceFactory(
     VSShell.SVsServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }