private async Task CreateSessionAsync() { await _sessionSemaphore.WaitAsync(); try { if (_session == null) { var provider = EditorShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>(); _session = provider.GetOrCreate(SessionId, null); _session.Disposed += OnSessionDisposed; } if (!_session.IsHostRunning) { int timeout = EditorShell.Current.IsUnitTestEnvironment ? 10000 : 3000; await _session.StartHostAsync(new RHostStartupInfo { Name = "RdData", RBasePath = RToolsSettings.Current.RBasePath, CranMirrorName = RToolsSettings.Current.CranMirror }, timeout); } } finally { _sessionSemaphore.Release(); } }
public async Task <ExecutionResult> InitializeAsync() { try { if (!Session.IsHostRunning) { var startupInfo = new RHostStartupInfo { Name = "REPL", RBasePath = _settings.RBasePath, RHostCommandLineArguments = _settings.RCommandLineArguments, CranMirrorName = _settings.CranMirror, CodePage = _settings.RCodePage, WorkingDirectory = _settings.WorkingDirectory, TerminalWidth = _terminalWidth, }; CurrentWindow.TextView.VisualElement.SizeChanged += VisualElement_SizeChanged; await Session.StartHostAsync(startupInfo, new RSessionCallback(CurrentWindow, Session, _settings, _coreShell)); } return(ExecutionResult.Success); } catch (RHostBinaryMissingException) { await _coreShell.ShowErrorMessageAsync(Resources.Error_Microsoft_R_Host_Missing); return(ExecutionResult.Failure); } catch (Exception) { return(ExecutionResult.Failure); } }
public async Task InitializeAsync() { await _session.StartHostAsync(new RHostStartupInfo { Name = _testMethod.Name, RBasePath = RUtilities.FindExistingRBasePath() }, new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(nameof(CallStackTest)); await _session.StartHostAsync(new RHostStartupInfo { Name = _testMethod.Name }, new RHostClientTestApp(), 50000); }
public async Task InitializeAsync(IRSessionCallback clientApp = null) { _clientApp = clientApp ?? _clientApp; Session = SessionProvider.GetOrCreate(SessionNames.InteractiveWindow); if (Session.IsHostRunning) { await Session.StopHostAsync(); } await Session.StartHostAsync(new RHostStartupInfo(), _clientApp ?? new RHostClientTestApp(), 50000); }
public RHostScript(IRSessionProvider sessionProvider, IRHostClientApp clientApp = null) { SessionProvider = sessionProvider; Session = SessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, clientApp ?? new RHostClientTestApp()); Session.IsHostRunning.Should().BeFalse(); Session.StartHostAsync(new RHostStartupInfo { Name = "RHostScript", RBasePath = RToolsSettings.Current.RBasePath, RHostCommandLineArguments = RToolsSettings.Current.RCommandLineArguments, CranMirrorName = RToolsSettings.Current.CranMirror }, 50000).Wait(); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(GetType().Name); await _session.StartHostAsync(new RHostStartupInfo(), new RHostClientTestApp(), 50000); var workflow = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate(); var packages = await workflow.Packages.GetInstalledPackagesAsync(); if (!packages.Any(p => p.Package.EqualsIgnoreCase("QuantMod"))) { await workflow.Packages.InstallPackageAsync("QuantMod", null); } }
public RHostScript(IRSessionProvider sessionProvider, IRHostClientApp clientApp = null) { SessionProvider = sessionProvider; Session = SessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, clientApp ?? new RHostClientTestApp()); Session.IsHostRunning.Should().BeFalse(); Session.StartHostAsync(new RHostStartupInfo { Name = "RHostScript", RBasePath = RToolsSettings.Current.RBasePath, RHostCommandLineArguments = RToolsSettings.Current.RCommandLineArguments, CranMirrorName = RToolsSettings.Current.CranMirror }, 50000).Wait(); }
public async Task InitializeAsync(IRSessionCallback clientApp = null) { _clientApp = clientApp ?? _clientApp; Session = SessionProvider.GetOrCreate(SessionGuids.InteractiveWindowRSessionGuid); if (Session.IsHostRunning) { await Session.StopHostAsync(); } await Session.StartHostAsync(new RHostStartupInfo { Name = "RHostScript", CranMirrorName = RToolsSettings.Current.CranMirror, CodePage = RToolsSettings.Current.RCodePage, RHostCommandLineArguments = RToolsSettings.Current.LastActiveConnection.RCommandLineArguments }, _clientApp ?? new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(nameof(GridDataTest)); await _session.StartHostAsync(new RHostStartupInfo(), new RHostClientTestApp(), 50000); var packages = (await _session.InstalledPackagesAsync()).Select(p => p.ToObject <RPackage>()).ToList(); if (!packages.Any(p => p.Package.EqualsIgnoreCase("quantmod"))) { using (var request = await _session.BeginInteractionAsync()) { await request.InstallPackageAsync("quantmod"); } } }
public RHostScript(IRSessionProvider sessionProvider, IRHostBrokerConnector brokerConnector, IRSessionCallback clientApp = null) { SessionProvider = sessionProvider; Session = SessionProvider.GetOrCreate(GuidList.InteractiveWindowRSessionGuid, brokerConnector); if (Session.IsHostRunning) { Session.StopHostAsync().Wait(); } Session.StartHostAsync(new RHostStartupInfo { Name = "RHostScript", CranMirrorName = RToolsSettings.Current.CranMirror, CodePage = RToolsSettings.Current.RCodePage, RHostCommandLineArguments = RToolsSettings.Current.LastActiveConnection.RCommandLineArguments }, clientApp ?? new RHostClientTestApp(), 50000).Wait(); }
public async Task <ExecutionResult> InitializeAsync() { try { if (!Session.IsHostRunning) { await Session.StartHostAsync(new RHostStartupInfo { Name = "REPL", RBasePath = _settings.RBasePath, RHostCommandLineArguments = _settings.RCommandLineArguments, CranMirrorName = _settings.CranMirror, WorkingDirectory = _settings.WorkingDirectory }); } return(ExecutionResult.Success); } catch (RHostBinaryMissingException) { await _coreShell.DispatchOnMainThreadAsync(() => _coreShell.ShowErrorMessage(Resources.Error_Microsoft_R_Host_Missing)); return(ExecutionResult.Failure); } catch (Exception) { return(ExecutionResult.Failure); } }
public async Task InitializeAsync() { await _session.StartHostAsync(new RHostStartupInfo { Name = _testMethod.Name }, new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(nameof(DebugReplTest)); await _session.StartHostAsync(new RHostStartupInfo(), new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _remoteBroker.ConnectAsync(_sessionProvider); await _session.StartHostAsync(new RHostStartupInfo(), new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(GetType().Name); await _session.StartHostAsync(new RHostStartupInfo(), new RHostClientTestApp(), 50000); }
public async Task InitializeAsync() { await _sessionProvider.TrySwitchBrokerAsync(nameof(BreakpointsTest)); await _session.StartHostAsync(new RHostStartupInfo(isInteractive : true), new RHostClientTestApp(), 50000); }