Beispiel #1
0
        private IServerListener CreateServiceListener(MessageProtocolType protocol, EditorServiceTransportConfig config)
        {
            switch (config.TransportType)
            {
            case EditorServiceTransportType.Stdio:
            {
                return(new StdioServerListener(protocol, this.logger));
            }

            case EditorServiceTransportType.NamedPipe:
            {
                if ((config.OutPipeName != null) && (config.InPipeName != null))
                {
                    this.logger.Write(LogLevel.Verbose, $"Creating NamedPipeServerListener for ${protocol} protocol with two pipes: In: '{config.InPipeName}'. Out: '{config.OutPipeName}'");
                    return(new NamedPipeServerListener(protocol, config.InPipeName, config.OutPipeName, this.logger));
                }
                else
                {
                    return(new NamedPipeServerListener(protocol, config.InOutPipeName, this.logger));
                }
            }

            default:
            {
                throw new NotSupportedException();
            }
            }
        }
        private IServerListener CreateServiceListener(MessageProtocolType protocol, EditorServiceTransportConfig config)
        {
            switch (config.TransportType)
            {
            case EditorServiceTransportType.Tcp:
            {
                return(new TcpSocketServerListener(protocol, int.Parse(config.Endpoint), this.logger));
            }

            case EditorServiceTransportType.Stdio:
            {
                return(new StdioServerListener(protocol, this.logger));
            }

            case EditorServiceTransportType.NamedPipe:
            {
                return(new NamedPipeServerListener(protocol, config.Endpoint, this.logger));
            }

            default:
            {
                throw new NotSupportedException();
            }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Starts the debug service with the specified config.
        /// </summary>
        /// <param name="config">The config that contains information on the communication protocol that will be used.</param>
        /// <param name="profilePaths">The profiles that will be loaded in the session.</param>
        /// <param name="useExistingSession">Determines if we will reuse the session that we have.</param>
        public void StartDebugService(
            EditorServiceTransportConfig config,
            ProfilePaths profilePaths,
            bool useExistingSession)
        {
            this.debugServiceListener = CreateServiceListener(MessageProtocolType.DebugAdapter, config);
            this.debugServiceListener.ClientConnect += OnDebugServiceClientConnect;
            this.debugServiceListener.Start();

            this.logger.Write(
                LogLevel.Normal,
                string.Format(
                    "Debug service started, type = {0}, endpoint = {1}",
                    config.TransportType, config.Endpoint));
        }
        /// <summary>
        /// Starts the language service with the specified TCP socket port.
        /// </summary>
        /// <param name="languageServicePort">The port number for the language service.</param>
        /// <param name="profilePaths">The object containing the profile paths to load for this session.</param>
        public void StartLanguageService(EditorServiceTransportConfig config, ProfilePaths profilePaths)
        {
            this.profilePaths = profilePaths;

            this.languageServiceListener = CreateServiceListener(MessageProtocolType.LanguageServer, config);

            this.languageServiceListener.ClientConnect += this.OnLanguageServiceClientConnect;
            this.languageServiceListener.Start();

            this.logger.Write(
                LogLevel.Normal,
                string.Format(
                    "Language service started, type = {0}, endpoint = {1}",
                    config.TransportType, config.Endpoint));
        }