Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            var    launchDebugger = false;
            string logFilePath    = null;
            var    logLevel       = LogLevel.Warning;

            logFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "ShaderTools");

            ArgumentSyntax.Parse(args, syntax =>
            {
                syntax.DefineOption("launchdebugger", ref launchDebugger, false, "Set whether to launch the debugger or not.");
                //syntax.DefineOption("logfilepath", ref logFilePath, true, "Fully qualified path to the log file.");
                syntax.DefineOption("loglevel", ref logLevel, x => (LogLevel)Enum.Parse(typeof(LogLevel), x), false, "Logging level.");
            });

            if (launchDebugger)
            {
                Debugger.Launch();
            }

            LanguageServerHost languageServerHost = null;

            try
            {
                languageServerHost = await LanguageServerHost.Create(
                    Console.OpenStandardInput(),
                    Console.OpenStandardOutput(),
                    logFilePath,
                    logLevel);
            }
            catch (Exception ex)
            {
                languageServerHost?.Dispose();
                Console.Error.WriteLine(ex);
                return;
            }

            try
            {
                await languageServerHost.WaitForExit;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return;
            }
            finally
            {
                languageServerHost.Dispose();
            }
        }
Ejemplo n.º 2
0
        public static async Task Main(string[] args)
        {
            // TODO: Make this an option.
            var logFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "ShaderTools");

            if (args.Contains("--launch-debugger"))
            {
                Debugger.Launch();
            }

            LanguageServerHost languageServerHost = null;

            try
            {
                languageServerHost = await LanguageServerHost.Create(
                    Console.OpenStandardInput(),
                    Console.OpenStandardOutput(),
                    logFilePath,
                    LogLevel.Warning);
            }
            catch (Exception ex)
            {
                languageServerHost?.Dispose();
                await Console.Error.WriteLineAsync(ex.ToString());

                return;
            }

            try
            {
                await languageServerHost.WaitForExit;
            }
            catch (Exception ex)
            {
                await Console.Error.WriteLineAsync(ex.ToString());

                return;
            }
            finally
            {
                languageServerHost.Dispose();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ShaderTools Language Server
        /// </summary>
        /// <param name="launchDebugger">Set whether to launch the debugger or not.</param>
        /// <param name="logLevel">Logging level.</param>
        /// <returns></returns>
        public static async Task Main(bool launchDebugger = false, LogLevel logLevel = LogLevel.Warning)
        {
            // TODO: Make this an option.
            var logFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "ShaderTools");

            if (launchDebugger)
            {
                Debugger.Launch();
            }

            LanguageServerHost languageServerHost = null;

            try
            {
                languageServerHost = await LanguageServerHost.Create(
                    Console.OpenStandardInput(),
                    Console.OpenStandardOutput(),
                    logFilePath,
                    logLevel);
            }
            catch (Exception ex)
            {
                languageServerHost?.Dispose();
                Console.Error.WriteLine(ex);
                return;
            }

            try
            {
                await languageServerHost.WaitForExit;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return;
            }
            finally
            {
                languageServerHost.Dispose();
            }
        }