• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PythonToolsService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PythonToolsService的典型用法代码示例。如果您正苦于以下问题:C# PythonToolsService类的具体用法?C# PythonToolsService怎么用?C# PythonToolsService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PythonToolsService类属于命名空间,在下文中一共展示了PythonToolsService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DefaultPythonLauncher

        public DefaultPythonLauncher(IServiceProvider serviceProvider, PythonToolsService pyService, IPythonProject/*!*/ project) {
            Utilities.ArgumentNotNull("project", project);

            _serviceProvider = serviceProvider;
            _pyService = pyService;
            _project = project;
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:7,代码来源:DefaultPythonLauncher.cs


示例2: OnCreate

        protected override void OnCreate() {
            base.OnCreate();

            _site = (IServiceProvider)this;

            _pyService = _site.GetPythonToolsService();

#if DEV14_OR_LATER
            // TODO: Get PYEnvironment added to image list
            BitmapImageMoniker = KnownMonikers.DockPanel;
#else
            BitmapResourceID = PythonConstants.ResourceIdForReplImages;
            BitmapIndex = 0;
#endif
            Caption = SR.GetString(SR.Environments);

            _service = _site.GetComponentModel().GetService<IInterpreterOptionsService>();
            
            _outputWindow = OutputWindowRedirector.GetGeneral(_site);
            Debug.Assert(_outputWindow != null);
            _statusBar = _site.GetService(typeof(SVsStatusbar)) as IVsStatusbar;
            
            var list = new ToolWindow();
            list.ViewCreated += List_ViewCreated;

            list.CommandBindings.Add(new CommandBinding(
                EnvironmentView.OpenInteractiveWindow,
                OpenInteractiveWindow_Executed,
                OpenInteractiveWindow_CanExecute
            ));
            list.CommandBindings.Add(new CommandBinding(
                EnvironmentView.OpenInteractiveOptions,
                OpenInteractiveOptions_Executed,
                OpenInteractiveOptions_CanExecute
            ));
            list.CommandBindings.Add(new CommandBinding(
                EnvironmentPathsExtension.StartInterpreter,
                StartInterpreter_Executed,
                StartInterpreter_CanExecute
            ));
            list.CommandBindings.Add(new CommandBinding(
                EnvironmentPathsExtension.StartWindowsInterpreter,
                StartInterpreter_Executed,
                StartInterpreter_CanExecute
            ));
            list.CommandBindings.Add(new CommandBinding(
                ApplicationCommands.Help,
                OnlineHelp_Executed,
                OnlineHelp_CanExecute
            ));
            list.CommandBindings.Add(new CommandBinding(
                ToolWindow.UnhandledException,
                UnhandledException_Executed,
                UnhandledException_CanExecute
            ));

            list.Service = _service;

            Content = list;
        }
开发者ID:munyirik,项目名称:PTVS,代码行数:60,代码来源:InterpreterListToolWindow.cs


示例3: CreateMockServiceProvider

        /// <summary>
        /// Sets up a limited service provider which can be used for testing.  
        /// 
        /// This will not include many of the services which are typically available in
        /// VS but is suitable for simple test cases which need just some base functionality.
        /// </summary>
        public static MockServiceProvider CreateMockServiceProvider() {
            var serviceProvider = new MockServiceProvider();

            serviceProvider.ComponentModel.AddExtension(
                typeof(IErrorProviderFactory),
                () => new MockErrorProviderFactory()
            );
            serviceProvider.ComponentModel.AddExtension(
                typeof(IContentTypeRegistryService),
                CreateContentTypeRegistryService
            );

            serviceProvider.ComponentModel.AddExtension(
                typeof(IInteractiveWindowCommandsFactory),
                () => new MockInteractiveWindowCommandsFactory()
            );

            serviceProvider.AddService(typeof(ErrorTaskProvider), CreateTaskProviderService, true);
            serviceProvider.AddService(typeof(CommentTaskProvider), CreateTaskProviderService, true);
            serviceProvider.AddService(typeof(UIThreadBase), new MockUIThread());
            var optionsService = new MockPythonToolsOptionsService();
            serviceProvider.AddService(typeof(IPythonToolsOptionsService), optionsService, true);

            var ptvsService = new PythonToolsService(serviceProvider);
            serviceProvider.AddService(typeof(PythonToolsService), ptvsService);
            return serviceProvider;
        }
开发者ID:KaushikCh,项目名称:PTVS,代码行数:33,代码来源:PythonToolsTestUtilities.cs


示例4: SyncPageWithControlSettings

 internal void SyncPageWithControlSettings(PythonToolsService pyService) {
     pyService.DebugInteractiveOptions.ReplSmartHistory = _smartReplHistory.Checked;
     pyService.DebugInteractiveOptions.PrimaryPrompt = _priPrompt.Text;
     pyService.DebugInteractiveOptions.SecondaryPrompt = _secPrompt.Text;
     pyService.DebugInteractiveOptions.LiveCompletionsOnly = _liveCompletionsOnly.Checked;
     pyService.DebugInteractiveOptions.UseInterpreterPrompts = !_useUserDefinedPrompts.Checked;
 }
开发者ID:KaushikCh,项目名称:PTVS,代码行数:7,代码来源:PythonDebugInteractiveOptionsControl.cs


示例5: PythonVisualStudioApp

        public PythonVisualStudioApp(DTE dte = null)
            : base(dte) {

            var shell = (IVsShell)ServiceProvider.GetService(typeof(SVsShell));
            var pkg = new Guid("6dbd7c1e-1f1b-496d-ac7c-c55dae66c783");
            IVsPackage pPkg;
            ErrorHandler.ThrowOnFailure(shell.LoadPackage(ref pkg, out pPkg));
            System.Threading.Thread.Sleep(1000);

            PythonToolsService = ServiceProvider.GetPythonToolsService_NotThreadSafe();
            Assert.IsNotNull(PythonToolsService, "Failed to get PythonToolsService");

            // Disable AutoListIdentifiers for tests
            var ao = PythonToolsService.AdvancedOptions;
            Assert.IsNotNull(ao, "Failed to get AdvancedOptions");
            var oldALI = ao.AutoListIdentifiers;
            ao.AutoListIdentifiers = false;

            var orwoodProp = Dte.Properties["Environment", "ProjectsAndSolution"].Item("OnRunWhenOutOfDate");
            Assert.IsNotNull(orwoodProp, "Failed to get OnRunWhenOutOfDate property");
            var oldOrwood = orwoodProp.Value;
            orwoodProp.Value = 1;

            OnDispose(() => {
                ao.AutoListIdentifiers = oldALI;
                orwoodProp.Value = oldOrwood;
            });
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:28,代码来源:PythonVisualStudioApp.cs


示例6: Initialize

        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(ErrorTaskProvider), CreateTaskProviderService, true);
            _serviceContainer.AddService(typeof(CommentTaskProvider), CreateTaskProviderService, true);

            var pyService = new PythonToolsService(_serviceContainer);
            _onDispose.Add(() => ((IDisposable)pyService).Dispose());
            _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
            );
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:34,代码来源:MockPythonToolsPackage.cs


示例7: SyncPageWithControlSettings

 internal void SyncPageWithControlSettings(PythonToolsService pyService) {
     pyService.DebuggerOptions.PromptBeforeRunningWithBuildError = _promptOnBuildError.Checked;
     pyService.DebuggerOptions.WaitOnAbnormalExit = _waitOnAbnormalExit.Checked;
     pyService.DebuggerOptions.WaitOnNormalExit = _waitOnNormalExit.Checked;
     pyService.DebuggerOptions.TeeStandardOutput = _teeStdOut.Checked;
     pyService.DebuggerOptions.BreakOnSystemExitZero = _breakOnSystemExitZero.Checked;
     pyService.DebuggerOptions.DebugStdLib = _debugStdLib.Checked;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:PythonDebuggingOptionsControl.cs


示例8: SyncControlWithPageSettings

 internal void SyncControlWithPageSettings(PythonToolsService pyService) {
     _promptOnBuildError.Checked = pyService.DebuggerOptions.PromptBeforeRunningWithBuildError;
     _waitOnAbnormalExit.Checked = pyService.DebuggerOptions.WaitOnAbnormalExit;
     _waitOnNormalExit.Checked = pyService.DebuggerOptions.WaitOnNormalExit;
     _teeStdOut.Checked = pyService.DebuggerOptions.TeeStandardOutput;
     _breakOnSystemExitZero.Checked = pyService.DebuggerOptions.BreakOnSystemExitZero;
     _debugStdLib.Checked = pyService.DebuggerOptions.DebugStdLib;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:PythonDebuggingOptionsControl.cs


示例9: SyncControlWithPageSettings

 internal void SyncControlWithPageSettings(PythonToolsService pyService) {
     _smartReplHistory.Checked = pyService.DebugInteractiveOptions.ReplSmartHistory;
     ReplIntellisenseMode = pyService.DebugInteractiveOptions.ReplIntellisenseMode;
     _priPrompt.Text = pyService.DebugInteractiveOptions.PrimaryPrompt;
     _secPrompt.Text = pyService.DebugInteractiveOptions.SecondaryPrompt;
     EnableUserDefinedPrompts(!pyService.DebugInteractiveOptions.UseInterpreterPrompts);
     _liveCompletionsOnly.Checked = pyService.DebugInteractiveOptions.LiveCompletionsOnly;
 }
开发者ID:KaushikCh,项目名称:PTVS,代码行数:8,代码来源:PythonDebugInteractiveOptionsControl.cs


示例10: PythonInteractiveOptions

 internal PythonInteractiveOptions(PythonToolsService pyService, string category) {
     _pyService = pyService;
     _category = category;
     _completionMode = ReplIntellisenseMode.DontEvaluateCalls;
     _smartHistory = true;
     _scripts = string.Empty;
     Load();
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:8,代码来源:PythonInteractiveOptions.cs


示例11: LibraryNodeVisitor

 public LibraryNodeVisitor(PythonToolsService pyService, PythonNavigateToItemProvider itemProvider, INavigateToCallback navCallback, string searchValue) {
     _pyService = pyService;
     _itemProvider = itemProvider;
     _navCallback = navCallback;
     _searchValue = searchValue;
     _path.Push(null);
     _comparer = new FuzzyStringMatcher(_pyService.AdvancedOptions.SearchMode);
     _regexComparer = new FuzzyStringMatcher(FuzzyMatchMode.RegexIgnoreCase);
 }
开发者ID:smallwave,项目名称:PTVS,代码行数:9,代码来源:PythonNavigateToItemProvider.cs


示例12: TemplateCompletionController

 public TemplateCompletionController(
     PythonToolsService pyService,
     ITextView textView,
     IList<ITextBuffer> subjectBuffers,
     ICompletionBroker completionBroker,
     IQuickInfoBroker quickInfoBroker,
     ISignatureHelpBroker signatureBroker) :
     base(textView, subjectBuffers, completionBroker, quickInfoBroker, signatureBroker) {
     _pyService = pyService;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:10,代码来源:TemplateCompletionController.cs


示例13: PythonInteractiveCommonOptions

 internal PythonInteractiveCommonOptions(PythonToolsService pyService, string category, string id) {
     _pyService = pyService;
     _category = category;
     _id = id;
     _priPrompt = DefaultPrompt;
     _secPrompt = DefaultSecondaryPrompt;
     _interpreterPrompts = true;
     _replIntellisenseMode = ReplIntellisenseMode.DontEvaluateCalls;
     _smartHistory = true;
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:10,代码来源:PythonInteractiveCommonOptions.cs


示例14: SyncControlWithPageSettings

 internal void SyncControlWithPageSettings(PythonToolsService pyService) {
     _enterCommits.Checked = pyService.AdvancedOptions.EnterCommitsIntellisense;
     _intersectMembers.Checked = pyService.AdvancedOptions.IntersectMembers;
     _filterCompletions.Checked = pyService.AdvancedOptions.FilterCompletions;
     _completionCommitedBy.Text = pyService.AdvancedOptions.CompletionCommittedBy;
     _newLineAfterCompleteCompletion.Checked = pyService.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord;
     _outliningOnOpen.Checked = pyService.AdvancedOptions.EnterOutliningModeOnOpen;
     _pasteRemovesReplPrompts.Checked = pyService.AdvancedOptions.PasteRemovesReplPrompts;
     _colorNames.Checked = pyService.AdvancedOptions.ColorNames;
     _autoListIdentifiers.Checked = pyService.AdvancedOptions.AutoListIdentifiers;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:11,代码来源:PythonAdvancedEditorOptionsControl.cs


示例15: SyncPageWithControlSettings

 internal void SyncPageWithControlSettings(PythonToolsService pyService) {
     pyService.AdvancedOptions.EnterCommitsIntellisense = _enterCommits.Checked;
     pyService.AdvancedOptions.IntersectMembers = _intersectMembers.Checked;
     pyService.AdvancedOptions.FilterCompletions = _filterCompletions.Checked;
     pyService.AdvancedOptions.CompletionCommittedBy = _completionCommitedBy.Text;
     pyService.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord = _newLineAfterCompleteCompletion.Checked;
     pyService.AdvancedOptions.EnterOutliningModeOnOpen = _outliningOnOpen.Checked;
     pyService.AdvancedOptions.PasteRemovesReplPrompts = _pasteRemovesReplPrompts.Checked;
     pyService.AdvancedOptions.ColorNames = _colorNames.Checked;
     pyService.AdvancedOptions.AutoListIdentifiers = _autoListIdentifiers.Checked;
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:11,代码来源:PythonAdvancedEditorOptionsControl.cs


示例16: PythonWebLauncher

 public PythonWebLauncher(
     IServiceProvider serviceProvider,
     LaunchConfiguration runConfig,
     LaunchConfiguration debugConfig,
     LaunchConfiguration defaultConfig
 ) {
     _serviceProvider = serviceProvider;
     _pyService = _serviceProvider.GetPythonToolsService();
     _runConfig = runConfig;
     _debugConfig = debugConfig;
     _defaultConfig = defaultConfig;
 }
开发者ID:zooba,项目名称:PTVS,代码行数:12,代码来源:PythonWebLauncher.cs


示例17: PythonDebugReplEvaluator

        public PythonDebugReplEvaluator(IServiceProvider serviceProvider) {
            _serviceProvider = serviceProvider;
            _pyService = serviceProvider.GetPythonToolsService();
            AD7Engine.EngineAttached += new EventHandler<AD7EngineEventArgs>(OnEngineAttached);
            AD7Engine.EngineDetaching += new EventHandler<AD7EngineEventArgs>(OnEngineDetaching);

            var dte = _serviceProvider.GetDTE();
            if (dte != null) {
                // running outside of VS, make this work for tests.
                _debuggerEvents = dte.Events.DebuggerEvents;
                _debuggerEvents.OnEnterBreakMode += new EnvDTE._dispDebuggerEvents_OnEnterBreakModeEventHandler(OnEnterBreakMode);
            }
        }
开发者ID:rotorliu,项目名称:PTVS,代码行数:13,代码来源:PythonDebugReplEvaluator.cs


示例18: ProfiledProcess

        public ProfiledProcess(PythonToolsService pyService, string exe, string args, string dir, Dictionary<string, string> envVars, ProcessorArchitecture arch) {
            if (arch != ProcessorArchitecture.X86 && arch != ProcessorArchitecture.Amd64) {
                throw new InvalidOperationException(String.Format("Unsupported architecture: {0}", arch));
            }
            if (dir.EndsWith("\\")) {
                dir = dir.Substring(0, dir.Length - 1);
            }
            if (String.IsNullOrEmpty(dir)) {
                dir = ".";
            }
            _pyService = pyService;
            _exe = exe;
            _args = args;
            _dir = dir;
            _arch = arch;

            ProcessStartInfo processInfo;
            string pythonInstallDir = Path.GetDirectoryName(PythonToolsInstallPath.GetFile("VsPyProf.dll"));
            string dll = _arch == ProcessorArchitecture.Amd64 ? "VsPyProf.dll" : "VsPyProfX86.dll";
            string arguments = "\"" + Path.Combine(pythonInstallDir, "proflaun.py") + "\" " +
                "\"" + Path.Combine(pythonInstallDir, dll) + "\" " +
                "\"" + dir + "\" " +
                _args;

            processInfo = new ProcessStartInfo(_exe, arguments);
            if (_pyService.DebuggerOptions.WaitOnNormalExit) {
                processInfo.EnvironmentVariables["VSPYPROF_WAIT_ON_NORMAL_EXIT"] = "1";
            }
            if (_pyService.DebuggerOptions.WaitOnAbnormalExit) {
                processInfo.EnvironmentVariables["VSPYPROF_WAIT_ON_ABNORMAL_EXIT"] = "1";
            }
            
            processInfo.CreateNoWindow = false;
            processInfo.UseShellExecute = false;
            processInfo.RedirectStandardOutput = false;
            processInfo.WorkingDirectory = _dir;

            if (envVars != null) {
                foreach (var keyValue in envVars) {
                    processInfo.EnvironmentVariables[keyValue.Key] = keyValue.Value;
                }
            }

            _process = new Process();
            _process.StartInfo = processInfo;
        }
开发者ID:smallwave,项目名称:PTVS,代码行数:46,代码来源:ProfiledProcess.cs


示例19: PythonWebLauncher

        public PythonWebLauncher(IServiceProvider serviceProvider, PythonToolsService pyService, IPythonProject project) {
            _pyService = pyService;
            _project = project;
            _serviceProvider = serviceProvider;

            var project2 = project as IPythonProject2;
            if (project2 != null) {
                // The provider may return its own object, but the web launcher only
                // supports instances of CustomCommand.
                _runServerCommand = project2.FindCommand(RunWebServerCommand);
                _debugServerCommand = project2.FindCommand(DebugWebServerCommand);
            }

            var portNumber = _project.GetProperty(PythonConstants.WebBrowserPortSetting);
            int portNum;
            if (Int32.TryParse(portNumber, out portNum)) {
                _testServerPort = portNum;
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:19,代码来源:PythonWebLauncher.cs


示例20: LanguagePreferences

        public LanguagePreferences(PythonToolsService service, Guid languageGuid) {
            _service = service;
            _service.Site.AssertShellIsInitialized();

            _textMgr = (IVsTextManager)service.Site.GetService(typeof(SVsTextManager));
            if (_textMgr == null) {
                throw new NotSupportedException("");
            }

            var langPrefs = new LANGPREFERENCES[1];
            langPrefs[0].guidLang = languageGuid;
            ErrorHandler.ThrowOnFailure(_textMgr.GetUserPreferences(null, null, langPrefs, null));
            _preferences = langPrefs[0];

            var guid = typeof(IVsTextManagerEvents2).GUID;
            IConnectionPoint connectionPoint = null;
            (_textMgr as IConnectionPointContainer)?.FindConnectionPoint(ref guid, out connectionPoint);
            if (connectionPoint != null) {
                connectionPoint.Advise(this, out _cookie);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:21,代码来源:LanguagePreferences.cs



注:本文中的PythonToolsService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PythonTuple类代码示例发布时间:2022-05-24
下一篇:
C# PythonProjectNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap