예제 #1
0
        /// <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);
        }
예제 #2
0
        private App(StreamJsonRpc.JsonRpc mainRpcChannel, TestContext testContext)
        {
            m_progressReporter = new ProgressReporter(mainRpcChannel, testContext);

            m_testContext    = testContext;
            m_mainRpcChannel = mainRpcChannel;

            m_mainRpcChannel.AddLocalRpcTarget(this, new JsonRpcTargetOptions {
                AllowNonPublicInvocation = true
            });

            m_tracer = new Tracer();

            // We need to create the project management provider before we start listening on the
            // RPC channel as you cannot attach them after it has started listening.
            m_projectManagementProvider = new ProjectManagementProvider(GetAppStateDelegate(), m_mainRpcChannel);
        }
예제 #3
0
        /// <nodoc/>
        public App(Stream clientStream, Stream serverStream, string pathToLogFile)
        {
            Contract.Requires(clientStream != null);
            Contract.Requires(serverStream != null);
            Contract.Requires(!string.IsNullOrEmpty(pathToLogFile));

            ContentHashingUtilities.SetDefaultHashType();

            // Note that we cannot start listening (i.e. use Attach) until
            // we have finished constructing the app.
            // Otherwise we can receive an incoming message
            // before we finish initialization.
            var jsonRpcChannel = new JsonRpcWithException(clientStream, serverStream, this);

            m_mainRpcChannel = jsonRpcChannel;

            m_mainRpcChannel.AddLocalRpcTarget(this, new JsonRpcTargetOptions {
                AllowNonPublicInvocation = true
            });

            // We need to create the project management provider before we start listening on the
            // RPC channel as you cannot attach them after it has started listening.
            m_projectManagementProvider = new ProjectManagementProvider(GetAppStateDelegate(), m_mainRpcChannel);

            m_tracer = new Tracer(m_mainRpcChannel, pathToLogFile, EventLevel.Verbose, EventLevel.Informational);

            m_progressReporter = new ProgressReporter(m_mainRpcChannel, testContext: null);

            Logger.LanguageServerStarted(LoggingContext);
            Logger.LanguageServerLogFileLocation(LoggingContext, pathToLogFile);

            jsonRpcChannel.SetLoggingContext(Logger, LoggingContext);

            // Change minimal number of threads for performance reasons.
            // 5 is a reasonable number that should prevent thread pool exhaustion and will not spawn too many threads.
            ThreadPoolHelper.ConfigureWorkerThreadPools(Environment.ProcessorCount, 5);

            // This must be last after initialization
            m_mainRpcChannel.StartListening();

            SubscribeToUnhandledErrors();
        }