public void Initialize() { var settings = (IVsSettingsManager)_serviceContainer.GetService(typeof(SVsSettingsManager)); IVsWritableSettingsStore store; ErrorHandler.ThrowOnFailure(settings.GetWritableSettingsStore((uint)SettingsScope.Configuration, out store)); _serviceContainer.AddService(typeof(IPythonToolsOptionsService), (sp, t) => new MockPythonToolsOptionsService()); _serviceContainer.AddService(typeof(IClipboardService), (sp, t) => new MockClipboardService()); _serviceContainer.AddService(typeof(MockErrorProviderFactory), (sp, t) => new MockErrorProviderFactory(), true); _serviceContainer.AddService(typeof(PythonLanguageInfo), (sp, t) => new PythonLanguageInfo(sp), true); _serviceContainer.AddService(typeof(PythonToolsService), (sp, t) => new PythonToolsService(sp), true); _serviceContainer.AddService(typeof(ErrorTaskProvider), CreateTaskProviderService, true); _serviceContainer.AddService(typeof(CommentTaskProvider), CreateTaskProviderService, true); _serviceContainer.AddService(typeof(SolutionEventsListener), (sp, t) => new SolutionEventsListener(sp), true); UIThread.EnsureService(_serviceContainer); _serviceContainer.AddService(typeof(IPythonLibraryManager), (object)null); // register our project factory... var regProjectTypes = (IVsRegisterProjectTypes)_serviceContainer.GetService(typeof(SVsRegisterProjectTypes)); uint cookie; var guid = Guid.Parse(PythonConstants.ProjectFactoryGuid); regProjectTypes.RegisterProjectType( ref guid, new PythonProjectFactory(_serviceContainer), out cookie ); }
public void Initialize() { // Specifiy PythonTools\NoInterpreterFactories to suppress loading // all providers in tests. var settings = (IVsSettingsManager)_serviceContainer.GetService(typeof(SVsSettingsManager)); IVsWritableSettingsStore store; ErrorHandler.ThrowOnFailure(settings.GetWritableSettingsStore((uint)SettingsScope.Configuration, out store)); ErrorHandler.ThrowOnFailure(store.CreateCollection(@"PythonTools\NoInterpreterFactories")); _serviceContainer.AddService(typeof(IPythonToolsOptionsService), new MockPythonToolsOptionsService()); var errorProvider = new MockErrorProviderFactory(); _serviceContainer.AddService(typeof(MockErrorProviderFactory), errorProvider, true); _serviceContainer.AddService(typeof(IClipboardService), new MockClipboardService()); UIThread.EnsureService(_serviceContainer); _serviceContainer.AddService( typeof(Microsoft.PythonTools.Intellisense.ErrorTaskProvider), new ServiceCreatorCallback((container, type) => { var p = new Microsoft.PythonTools.Intellisense.ErrorTaskProvider(_serviceContainer, null, errorProvider); lock (_onDispose) { _onDispose.Add(() => p.Dispose()); } return(p); }), true ); _serviceContainer.AddService( typeof(Microsoft.PythonTools.Intellisense.CommentTaskProvider), new ServiceCreatorCallback((container, type) => { var p = new Microsoft.PythonTools.Intellisense.CommentTaskProvider(_serviceContainer, null, errorProvider); lock (_onDispose) { _onDispose.Add(() => p.Dispose()); } return(p); }), true ); var pyService = new PythonToolsService(_serviceContainer); _serviceContainer.AddService(typeof(PythonToolsService), pyService, true); _serviceContainer.AddService(typeof(IPythonLibraryManager), (object)null); // register our project factory... var regProjectTypes = (IVsRegisterProjectTypes)_serviceContainer.GetService(typeof(SVsRegisterProjectTypes)); uint cookie; var guid = Guid.Parse(PythonConstants.ProjectFactoryGuid); regProjectTypes.RegisterProjectType( ref guid, new PythonProjectFactory(_serviceContainer), out cookie ); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { UIThread.EnsureService(this); base.Initialize(); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); UIThread.EnsureService(this); _projectSystem = new ProjectSystemClient(DTE); CookiecutterTelemetry.Initialize(); }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine("Entering Initialize() of: {0}".FormatInvariant(this)); base.Initialize(); UIThread.EnsureService(this); _projectSystem = new ProjectSystemClient(DTE); CookiecutterTelemetry.Initialize(); }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); UIThread.EnsureService(this); RegisterCommands(new Command[] { new CookiecutterExplorerCommand(), new CreateFromCookiecutterCommand(), new AddFromCookiecutterCommand(), }, PackageGuids.guidCookiecutterCmdSet); }
public void Initialize() { _serviceContainer.AddService(typeof(IPythonToolsOptionsService), new MockPythonToolsOptionsService()); var errorProvider = new MockErrorProviderFactory(); _serviceContainer.AddService(typeof(MockErrorProviderFactory), errorProvider, true); _serviceContainer.AddService(typeof(IClipboardService), new MockClipboardService()); UIThread.EnsureService(_serviceContainer); _serviceContainer.AddService( typeof(Microsoft.PythonTools.Intellisense.ErrorTaskProvider), new ServiceCreatorCallback((container, type) => new Microsoft.PythonTools.Intellisense.ErrorTaskProvider(_serviceContainer, null, errorProvider)), true ); _serviceContainer.AddService( typeof(Microsoft.PythonTools.Intellisense.CommentTaskProvider), new ServiceCreatorCallback((container, type) => new Microsoft.PythonTools.Intellisense.CommentTaskProvider(_serviceContainer, null, errorProvider)), true ); var pyService = new PythonToolsService(_serviceContainer); _serviceContainer.AddService(typeof(PythonToolsService), pyService, true); _serviceContainer.AddService(typeof(IPythonLibraryManager), (object)null); // register our project factory... var regProjectTypes = (IVsRegisterProjectTypes)_serviceContainer.GetService(typeof(SVsRegisterProjectTypes)); uint cookie; var guid = Guid.Parse(PythonConstants.ProjectFactoryGuid); regProjectTypes.RegisterProjectType( ref guid, new PythonProjectFactory(_serviceContainer), out cookie ); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); UIThread.EnsureService(this); var shell = (IVsShell)GetService(typeof(SVsShell)); // we call into the Node.js package, so we need it loaded. // TODO - Ideally this wouldn't be hardcoded in here but we don't have a good shared location // move this guid to be from a shared file // Guid nodePackage = new Guid("FE8A8C3D-328A-476D-99F9-2A24B75F8C7F"); IVsPackage package; shell.LoadPackage(ref nodePackage, out package); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidStartNodeProfiling); var oleMenuItem = new OleMenuCommand(StartProfilingWizard, menuCommandID); oleMenuItem.BeforeQueryStatus += IsProfilingActive; _startWizard = oleMenuItem; mcs.AddCommand(oleMenuItem); // Create the command for the menu item. menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidPerfExplorer); oleMenuItem = new OleMenuCommand(ShowPeformanceExplorer, menuCommandID); mcs.AddCommand(oleMenuItem); menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidAddPerfSession); oleMenuItem = new OleMenuCommand(AddPerformanceSession, menuCommandID); oleMenuItem.BeforeQueryStatus += IsProfilingActive; mcs.AddCommand(oleMenuItem); menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidStartProfiling); oleMenuItem = _startCommand = new OleMenuCommand(StartProfiling, menuCommandID); oleMenuItem.BeforeQueryStatus += IsProfilingActiveAndSessionsExist; mcs.AddCommand(oleMenuItem); // Exec is handled by the Performance Explorer node, but we want to handle QueryStatus here to disable // the command when another profiling session is running. menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidPerfCtxStartProfiling); oleMenuItem = _startCommandCtx = new OleMenuCommand(null, menuCommandID); oleMenuItem.BeforeQueryStatus += IsProfilingActiveAndSessionsExist; mcs.AddCommand(oleMenuItem); menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidStopProfiling); _stopCommand = oleMenuItem = new OleMenuCommand(StopProfiling, menuCommandID); oleMenuItem.BeforeQueryStatus += IsProfilingInactive; mcs.AddCommand(oleMenuItem); menuCommandID = new CommandID(ProfilingGuids.NodejsProfilingCmdSet, (int)PkgCmdIDList.cmdidStartPerformanceAnalysis); _startProfiling = oleMenuItem = new OleMenuCommand(StartPerfAnalysis, menuCommandID); oleMenuItem.BeforeQueryStatus += IsNodejsProjectStartup; mcs.AddCommand(oleMenuItem); } //Create Editor Factory. Note that the base Package class will call Dispose on it. base.RegisterEditorFactory(new ProfilingSessionEditorFactory(this)); }