本文整理汇总了C#中PythonToolsService类的典型用法代码示例。如果您正苦于以下问题:C# PythonToolsService类的具体用法?C# PythonToolsService怎么用?C# PythonToolsService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PythonToolsService类属于命名空间,在下文中一共展示了PythonToolsService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultPythonLauncher
public DefaultPythonLauncher(IServiceProvider serviceProvider, PythonToolsService pyService, IPythonProject/*!*/ project) {
Utilities.ArgumentNotNull("project", project);
_serviceProvider = serviceProvider;
_pyService = pyService;
_project = project;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
});
}
示例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
);
}
示例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;
}
示例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;
}
示例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;
}
示例10: PythonInteractiveOptions
internal PythonInteractiveOptions(PythonToolsService pyService, string category) {
_pyService = pyService;
_category = category;
_completionMode = ReplIntellisenseMode.DontEvaluateCalls;
_smartHistory = true;
_scripts = string.Empty;
Load();
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}