private async Task EnsureEslintBridgeClientIsInitialized(CancellationToken cancellationToken)
        {
            var port = await eslintBridgeProcess.Start();

            try
            {
                serverInitLocker.WaitOne();

                if (port != javascriptServerPort)
                {
                    javascriptServerPort = port;
                    shouldInitLinter     = true;
                    eslintBridgeClient?.Dispose();
                    eslintBridgeClient = eslintBridgeClientFactory.Create(javascriptServerPort);
                }

                if (shouldInitLinter)
                {
                    await eslintBridgeClient.InitLinter(activeRulesProvider.Get(), cancellationToken);

                    shouldInitLinter = false;
                }
            }
            finally
            {
                serverInitLocker.Set();
            }
        }
예제 #2
0
        protected async Task <string> MakeCall(string endpoint, object request, CancellationToken cancellationToken)
        {
            var port = await eslintBridgeProcess.Start();

            var fullServerUrl = BuildServerUri(port, endpoint);
            var response      = await httpWrapper.PostAsync(fullServerUrl, request, cancellationToken);

            return(response);
        }