/// <nodoc /> public ProgressReporter([NotNull] StreamJsonRpc.JsonRpc mainRpcChannel, TestContext?testContext) { Contract.Requires(mainRpcChannel != null); m_testContext = testContext; m_mainRpcChannel = mainRpcChannel; }
//------------------------------------------------------------------------------------------------ // construction //------------------------------------------------------------------------------------------------ public DeribitAuthenticationService(DeribitService deribit, IMapper mapper, IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc) { this.deribit = deribit; this.mapper = mapper; this.rpcproxy = rpcproxy; this.jsonrpc = jsonrpc; //--------------------------------------------------------------------- // refresh auth token periodically { this.RefreshAuthTokenTimer = new System.Timers.Timer() { Interval = TimeSpan.FromMinutes(this.RefreshAuthTokenLoopPeriodMins).TotalMilliseconds, Enabled = !this.deribit.deribitconfig.NoRefreshAuthToken, }; } this.RefreshAuthTokenTimer.Elapsed += async(sender, e) => { if (this.deribit.deribitconfig.NoRefreshAuthToken) { return; } await this.RefreshAuthTokenLoop(); }; //--------------------------------------------------------------------- }
//------------------------------------------------------------------------------------------------ // construction //------------------------------------------------------------------------------------------------ public DeribitSupportingService(DeribitService deribit, IMapper mapper, IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc) { this.deribit = deribit; this.mapper = mapper; this.rpcproxy = rpcproxy; this.jsonrpc = jsonrpc; }
/// <summary> /// Creates the providers for project management and adds them as targets /// to the JSON-RPC layer. /// </summary> public ProjectManagementProvider(GetAppState getAppState, StreamJsonRpc.JsonRpc rpcChannel) { m_moduleInformationProvider = new ModuleInformationProvider(getAppState); rpcChannel.AddLocalRpcTarget(m_moduleInformationProvider); m_addSourceFileToProjectProvider = new AddSourceFileToProjectProvider(getAppState); rpcChannel.AddLocalRpcTarget(m_addSourceFileToProjectProvider); }
//------------------------------------------------------------------------------------------------ // construction //------------------------------------------------------------------------------------------------ public DeribitAccountManagementService(DeribitService deribit, IMapper mapper, IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc) { this.deribit = deribit; this.mapper = mapper; this.rpcproxy = rpcproxy; this.jsonrpc = jsonrpc; }
/// <nodoc /> protected IdeProviderBase(ProviderContext providerContext) { ProviderContext = providerContext; JsonRpc = providerContext.JsonRpc; PathTable = providerContext.PathTable; m_incrementalWorkspaceProvider = providerContext.IncrementalWorkspaceProvider; m_incrementalWorkspaceProvider.WorkspaceRecomputed += OnWorkspaceRecomputed; ChangedTextDocumentItems = new TextDocumentItem[0]; }
//------------------------------------------------------------------------------------------------ // construction //------------------------------------------------------------------------------------------------ public DeribitSubscriptionManagementService(DeribitService deribit, IMapper mapper, IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc) { this.deribit = deribit; this.mapper = mapper; this.rpcproxy = rpcproxy; this.jsonrpc = jsonrpc; this.rpcproxy.subscription += this.handle_notification; }
//------------------------------------------------------------------------------------------------ // construction //------------------------------------------------------------------------------------------------ public DeribitSessionManagementService(DeribitService deribit, IMapper mapper, IDeribitJsonRpcProxy rpcproxy, StreamJsonRpc.JsonRpc jsonrpc) { this.deribit = deribit; this.mapper = mapper; this.rpcproxy = rpcproxy; this.jsonrpc = jsonrpc; this.rpcproxy.heartbeat += this.handle_heartbeat; }
/// <summary> /// Sends the window/showMessage notification to the LSP client. /// </summary> /// <returns>The task to send the window/showMessage notification.</returns> public static Task ShowMessageAsync(this StreamJsonRpc.JsonRpc jsonRpc, TestContext?testContext, MessageType messageType, string message) { return(Dispatch(jsonRpc, testContext, "window/showMessage", new ShowMessageParams() { MessageType = messageType, Message = message, })); }
/// <summary> /// Sends the window/showMessageRequest request to the LSP client. /// </summary> /// <returns>A task to send the window/showMessageRequest request.</returns> public static Task <MessageActionItem> ShowMessageRequestAsync(this StreamJsonRpc.JsonRpc jsonRpc, MessageType messageType, string message, params MessageActionItem[] actionItems) { return(jsonRpc.InvokeWithParameterObjectAsync <MessageActionItem>( "window/showMessageRequest", new ShowMessageRequestParams { MessageType = messageType, Message = message, Actions = actionItems, })); }
/// <summary> /// Creates the providers for project management and adds them as targets /// to the JSON-RPC layer. /// </summary> public ProjectManagementProvider(GetAppState getAppState, StreamJsonRpc.JsonRpc rpcChannel) { m_moduleInformationProvider = new ModuleInformationProvider(getAppState); var options = new StreamJsonRpc.JsonRpcTargetOptions { AllowNonPublicInvocation = true }; rpcChannel.AddLocalRpcTarget(m_moduleInformationProvider, options); m_addSourceFileToProjectProvider = new AddSourceFileToProjectProvider(getAppState); rpcChannel.AddLocalRpcTarget(m_addSourceFileToProjectProvider, options); }
public Tracer(StreamJsonRpc.JsonRpc pushRpc, string logFilePath, EventLevel logFileVerbosity, EventLevel outputPaneVerbosity) { Contract.Requires(pushRpc != null); Contract.Requires(!string.IsNullOrEmpty(logFilePath)); Contract.Requires(logFileVerbosity > outputPaneVerbosity, $"Log file verbosity ('{logFileVerbosity}') should be more detailed than output pane verbosity '{outputPaneVerbosity}'."); m_logFilePath = logFilePath; var outputEventWriter = new OutputWindowEventWriter( new OutputWindowReporter(pushRpc), File.CreateText(logFilePath), outputPaneVerbosity); m_loggingListeners = SetupLogging(logFileVerbosity, outputEventWriter); }
private static Task Dispatch <T>(StreamJsonRpc.JsonRpc jsonRpc, TestContext?testContext, string message, T param) { if (testContext?.ForceSynchronousMessages == true) { // If we need to force messages to be synchronous, then we always // do 'invoke' instead of 'notify', and we always wait for the task // to finish jsonRpc.InvokeWithParameterObjectAsync <object>(message, param).GetAwaiter().GetResult(); // Return a 'do nothing' task in this case return(Task.FromResult(0)); } return(jsonRpc.NotifyWithParameterObjectAsync(message, param)); }
/// <nodoc/> public ProviderContext( [NotNull] StreamJsonRpc.JsonRpc jsonRpc, [NotNull] IncrementalWorkspaceProvider incrementalWorkspaceProvider, [NotNull] PathTable pathTable, [NotNull] Logger logger, [NotNull] LoggingContext loggingContext, [NotNull] GetAppState getAppState, TestContext?testContext = null) { JsonRpc = jsonRpc; IncrementalWorkspaceProvider = incrementalWorkspaceProvider; PathTable = pathTable; TestContext = testContext; Logger = logger; LoggingContext = loggingContext; GetAppState = getAppState; }
public OutputWindowReporter(StreamJsonRpc.JsonRpc pushRpc) { m_pushRpc = pushRpc; }