本文整理汇总了C#中IInteractiveWindow类的典型用法代码示例。如果您正苦于以下问题:C# IInteractiveWindow类的具体用法?C# IInteractiveWindow怎么用?C# IInteractiveWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInteractiveWindow类属于命名空间,在下文中一共展示了IInteractiveWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VsInteractiveWindowCommandFilter
public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry)
{
_window = window;
_oleCommandTargetProviders = oleCommandTargetProviders;
_contentTypeRegistry = contentTypeRegistry;
this.textViewAdapter = textViewAdapter;
// make us a code window so we'll have the same colors as a normal code window.
IVsTextEditorPropertyContainer propContainer;
ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer));
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true);
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true);
// editor services are initialized in textViewAdapter.Initialize - hook underneath them:
_preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter));
textViewAdapter.Initialize(
(IVsTextLines)bufferAdapter,
IntPtr.Zero,
(uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT,
new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } });
// disable change tracking because everything will be changed
var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter);
_preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter));
_textViewHost = textViewHost;
}
示例2:
IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
{
WpfTestCase.RequireWpfFact($"Creates an IWpfTextView in {nameof(InteractiveWindowEditorsFactoryService)}");
var textView = _textEditorFactoryService.CreateTextView(buffer, roles);
return _textEditorFactoryService.CreateTextViewHost(textView, false).TextView;
}
示例3: ParseArguments
private bool ParseArguments(IInteractiveWindow window, string arguments, out string commandName, out IInteractiveWindowCommand command)
{
string name = arguments.Split(s_whitespaceChars)[0];
if (name.Length == 0)
{
command = null;
commandName = null;
return true;
}
var commands = window.GetInteractiveCommands();
string prefix = commands.CommandPrefix;
// display help on a particular command:
command = commands[name];
if (command == null && name.StartsWith(prefix, StringComparison.Ordinal))
{
name = name.Substring(prefix.Length);
command = commands[name];
}
commandName = name;
return command != null;
}
示例4: Execute
public Task<ExecutionResult> Execute(IInteractiveWindow window, string arguments)
{
var engine = window.Evaluator as InteractiveEvaluator;
if (engine != null)
{
int i = 0;
string path;
if (!CommandArgumentsParser.ParsePath(arguments, ref i, out path) || path == null)
{
ReportInvalidArguments(window);
return ExecutionResult.Failed;
}
if (!CommandArgumentsParser.ParseTrailingTrivia(arguments, ref i))
{
window.ErrorOutputWriter.WriteLine(string.Format(EditorFeaturesResources.UnexpectedText, arguments.Substring(i)));
return ExecutionResult.Failed;
}
return engine.LoadCommandAsync(path);
}
return ExecutionResult.Failed;
}
示例5: Execute
public Task<ExecutionResult> Execute(IInteractiveWindow window, string arguments) {
var eval = window.Evaluator as PythonDebugReplEvaluator;
if (eval != null) {
eval.StepInto();
}
return ExecutionResult.Succeeded;
}
示例6: Execute
internal Task Execute(IInteractiveWindow interactiveWindow, string title)
{
ImmutableArray<string> references, referenceSearchPaths, sourceSearchPaths, namespacesToImport;
string projectDirectory;
if (GetProjectProperties(out references, out referenceSearchPaths, out sourceSearchPaths, out namespacesToImport, out projectDirectory))
{
// Now, we're going to do a bunch of async operations. So create a wait
// indicator so the user knows something is happening, and also so they cancel.
var waitIndicator = GetWaitIndicator();
var waitContext = waitIndicator.StartWait(title, InteractiveEditorFeaturesResources.BuildingProject, allowCancel: true);
var resetInteractiveTask = ResetInteractiveAsync(
interactiveWindow,
references,
referenceSearchPaths,
sourceSearchPaths,
namespacesToImport,
projectDirectory,
waitContext);
// Once we're done resetting, dismiss the wait indicator and focus the REPL window.
return resetInteractiveTask.SafeContinueWith(
_ =>
{
waitContext.Dispose();
ExecutionCompleted?.Invoke(this, new EventArgs());
},
TaskScheduler.FromCurrentSynchronizationContext());
}
return Task.CompletedTask;
}
示例7: Execute
public Task<ExecutionResult> Execute(IInteractiveWindow window, string arguments) {
var eval = window.GetPythonDebugReplEvaluator();
if (eval != null) {
eval.DisplayProcesses();
}
return ExecutionResult.Succeeded;
}
示例8:
ITextBuffer IInteractiveWindowEditorFactoryService.CreateAndActivateBuffer(IInteractiveWindow window) {
IContentType contentType;
if (!window.Properties.TryGetProperty(typeof(IContentType), out contentType)) {
contentType = _contentTypeRegistry.GetContentType(ContentType);
}
return _textBufferFactoryService.CreateTextBuffer(contentType);
}
示例9: Execute
public Task<ExecutionResult> Execute(IInteractiveWindow window, string arguments) {
var remoteEval = window.Evaluator as IMultipleScopeEvaluator;
Debug.Assert(remoteEval != null, "Evaluator does not support switching scope");
if (remoteEval != null) {
remoteEval.SetScope(arguments);
}
return ExecutionResult.Succeeded;
}
示例10: TestInteractiveCommandHandler
public TestInteractiveCommandHandler(
IInteractiveWindow interactiveWindow,
IContentTypeRegistryService contentTypeRegistryService,
IEditorOptionsFactoryService editorOptionsFactoryService,
IEditorOperationsFactoryService editorOperationsFactoryService)
: base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService)
{
_interactiveWindow = interactiveWindow;
}
示例11: GetTextViewHost
public IWpfTextViewHost GetTextViewHost(IInteractiveWindow window)
{
var cmdFilter = GetCommandFilter(window);
if (cmdFilter != null)
{
return cmdFilter.TextViewHost;
}
return null;
}
示例12: RInteractiveWindowVisualComponent
public RInteractiveWindowVisualComponent(IInteractiveWindow interactiveWindow, IVisualComponentContainer<IInteractiveWindowVisualComponent> container) {
InteractiveWindow = interactiveWindow;
Container = container;
var textView = interactiveWindow.TextView;
Controller = ServiceManagerBase.GetService<ICommandTarget>(textView);
Control = textView.VisualElement;
interactiveWindow.Properties.AddProperty(typeof(IInteractiveWindowVisualComponent), this);
}
示例13: MockInteractiveWindowCommands
public MockInteractiveWindowCommands(
IInteractiveWindow window,
string prefix,
IEnumerable<IInteractiveWindowCommand> commands
) {
CommandPrefix = prefix;
_window = window;
_commands = commands.ToList();
}
示例14: RSessionCallback
public RSessionCallback(IInteractiveWindow interactiveWindow, IRSession session, IRSettings settings, ICoreShell coreShell, IFileSystem fileSystem) {
_interactiveWindow = interactiveWindow;
_session = session;
_settings = settings;
_coreShell = coreShell;
_fileSystem = fileSystem;
var workflowProvider = _coreShell.ExportProvider.GetExportedValue<IRInteractiveWorkflowProvider>();
_workflow = workflowProvider.GetOrCreate();
}
示例15: ResetInteractiveAsync
private async Task ResetInteractiveAsync(
IInteractiveWindow interactiveWindow,
ImmutableArray<string> referencePaths,
ImmutableArray<string> referenceSearchPaths,
ImmutableArray<string> sourceSearchPaths,
ImmutableArray<string> projectNamespaces,
string projectDirectory,
IWaitContext waitContext)
{
// First, open the repl window.
IInteractiveEvaluator evaluator = interactiveWindow.Evaluator;
// If the user hits the cancel button on the wait indicator, then we want to stop the
// build.
using (waitContext.CancellationToken.Register(() =>
CancelBuildProject(), useSynchronizationContext: true))
{
// First, start a build.
// If the build fails do not reset the REPL.
var builtSuccessfully = await BuildProject().ConfigureAwait(true);
if (!builtSuccessfully)
{
return;
}
}
// Then reset the REPL
waitContext.Message = InteractiveEditorFeaturesResources.Resetting_Interactive;
await interactiveWindow.Operations.ResetAsync(initialize: true).ConfigureAwait(true);
// TODO: load context from an rsp file.
// Now send the reference paths we've collected to the repl.
// The SetPathsAsync method is not available through an Interface.
// Execute the method only if the cast to a concrete InteractiveEvaluator succeeds.
InteractiveEvaluator interactiveEvaluator = evaluator as InteractiveEvaluator;
if (interactiveEvaluator != null)
{
await interactiveEvaluator.SetPathsAsync(referenceSearchPaths, sourceSearchPaths, projectDirectory).ConfigureAwait(true);
}
var editorOptions = _editorOptionsFactoryService.GetOptions(interactiveWindow.CurrentLanguageBuffer);
var importReferencesCommand = referencePaths.Select(_createReference);
await interactiveWindow.SubmitAsync(importReferencesCommand).ConfigureAwait(true);
// Project's default namespace might be different from namespace used within project.
// Filter out namespace imports that do not exist in interactive compilation.
IEnumerable<string> namespacesToImport = await GetNamespacesToImportAsync(projectNamespaces, interactiveWindow).ConfigureAwait(true);
var importNamespacesCommand = namespacesToImport.Select(_createImport).Join(editorOptions.GetNewLineCharacter());
if (!string.IsNullOrWhiteSpace(importNamespacesCommand))
{
await interactiveWindow.SubmitAsync(new[] { importNamespacesCommand }).ConfigureAwait(true);
}
}