Ejemplo n.º 1
0
 public static LanguageServerOptions WithConfigurationSection(this LanguageServerOptions options, string sectionName)
 {
     options.Services.AddSingleton(new ConfigurationItem {
         Section = sectionName
     });
     return(options);
 }
        /// <summary>
        /// Create the server without connecting to the client
        ///
        /// Mainly used for unit testing
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static ILanguageServer PreInit(LanguageServerOptions options)
        {
            var server = new LanguageServer(
                options.Input,
                options.Output,
                options.Reciever,
                options.RequestProcessIdentifier,
                options.LoggerFactory,
                options.Serializer,
                options.Services,
                options.HandlerTypes.Select(x => x.Assembly)
                .Distinct().Concat(options.HandlerAssemblies),
                options.Handlers,
                options.HandlerTypes,
                options.NamedHandlers,
                options.NamedServiceHandlers,
                options.TextDocumentIdentifiers,
                options.TextDocumentIdentifierTypes,
                options.InitializeDelegates,
                options.InitializedDelegates
                );

            if (options.AddDefaultLoggingProvider)
            {
                options.LoggerFactory.AddProvider(new LanguageServerLoggerProvider(server));
            }

            return(server);
        }
Ejemplo n.º 3
0
        public static async Task <ILanguageServer> From(LanguageServerOptions options)
        {
            var server = new LanguageServer(
                options.Input,
                options.Output,
                options.Reciever,
                options.RequestProcessIdentifier,
                options.LoggerFactory,
                options.Serializer,
                options.Services,
                options.HandlerTypes.Select(x => x.Assembly)
                .Distinct().Concat(options.HandlerAssemblies),
                options.InitializeDelegates,
                options.InitializedDelegates
                );

            if (options.AddDefaultLoggingProvider)
            {
                options.LoggerFactory.AddProvider(new LanguageServerLoggerProvider(server));
            }

            await server.Initialize();

            return(server);
        }
        public static Task <LanguageServer> From(Action <LanguageServerOptions> optionsAction, IServiceProvider outerServiceProvider, CancellationToken cancellationToken)
        {
            var options = new LanguageServerOptions();

            optionsAction(options);
            return(From(options, outerServiceProvider, cancellationToken));
        }
        public static LanguageServer Create(Action <LanguageServerOptions> optionsAction, IServiceProvider outerServiceProvider)
        {
            var options = new LanguageServerOptions();

            optionsAction(options);
            return(Create(options, outerServiceProvider));
        }
Ejemplo n.º 6
0
        public static Task <ILanguageServer> From(Action <LanguageServerOptions> optionsAction, CancellationToken token)
        {
            var options = new LanguageServerOptions();

            optionsAction(options);
            return(From(options, token));
        }
        public static async Task <LanguageServer> From(LanguageServerOptions options, IServiceProvider outerServiceProvider, CancellationToken cancellationToken)
        {
            var server = Create(options, outerServiceProvider);
            await server.Initialize(cancellationToken);

            return(server);
        }
Ejemplo n.º 8
0
        public static ILanguageServer PreInit(Action <LanguageServerOptions> optionsAction)
        {
            var options = new LanguageServerOptions();

            optionsAction(options);
            return(PreInit(options));
        }
Ejemplo n.º 9
0
        public static async Task <ILanguageServer> From(LanguageServerOptions options, CancellationToken token)
        {
            var server = (LanguageServer)PreInit(options);
            await server.Initialize(token);

            return(server);
        }
Ejemplo n.º 10
0
        public static Task <ILanguageServer> From(Action <LanguageServerOptions> optionsAction)
        {
            var options = new LanguageServerOptions();

            optionsAction(options);
            return(From(options));
        }
 /// <summary>
 /// Create the server without connecting to the client
 ///
 /// Mainly used for unit testing
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static ILanguageServer PreInit(LanguageServerOptions options)
 {
     return(new LanguageServer(
                options.Input,
                options.Output,
                options.Receiver,
                options.RequestProcessIdentifier,
                options.Serializer,
                options.Services,
                options.HandlerTypes.Select(x => x.Assembly)
                .Distinct().Concat(options.HandlerAssemblies),
                options.Handlers,
                options.HandlerTypes,
                options.NamedHandlers,
                options.NamedServiceHandlers,
                options.TextDocumentIdentifiers,
                options.TextDocumentIdentifierTypes,
                options.InitializeDelegates,
                options.InitializedDelegates,
                options.StartedDelegates,
                options.LoggingBuilderAction,
                options.AddDefaultLoggingProvider,
                options.ProgressManager,
                options.ServerInfo,
                options.ConfigurationBuilderAction,
                options.Concurrency
                ));
 }
Ejemplo n.º 12
0
 public static LanguageServerOptions WithReceiver(
     this LanguageServerOptions options,
     ILspServerReceiver serverReceiver
     )
 {
     options.Services.AddSingleton(serverReceiver);
     return(options);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create the server without connecting to the client
 ///
 /// Mainly used for unit testing
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static ILanguageServer PreInit(LanguageServerOptions options)
 {
     return(new LanguageServer(
                options.Input,
                options.Output,
                options.Reciever,
                options.RequestProcessIdentifier,
                options.Serializer,
                options.Services,
                options.HandlerTypes.Select(x => x.Assembly)
                .Distinct().Concat(options.HandlerAssemblies),
                options.Handlers,
                options.HandlerTypes,
                options.NamedHandlers,
                options.NamedServiceHandlers,
                options.TextDocumentIdentifiers,
                options.TextDocumentIdentifierTypes,
                options.InitializeDelegates,
                options.InitializedDelegates,
                options.LoggingBuilderAction
                ));
 }
Ejemplo n.º 14
0
 public static LanguageServerOptions WithServerInfo(this LanguageServerOptions options, ServerInfo serverInfo)
 {
     options.ServerInfo = serverInfo;
     return(options);
 }
Ejemplo n.º 15
0
 public static LanguageServerOptions WithSerializer(this LanguageServerOptions options, LspSerializer serializer)
 {
     options.Serializer = serializer;
     return(options);
 }
Ejemplo n.º 16
0
 public static LanguageServerOptions OnInitialize(this LanguageServerOptions options, OnLanguageServerInitializeDelegate @delegate)
 {
     options.Services.AddSingleton(@delegate);
     return(options);
 }
Ejemplo n.º 17
0
 public static Task <ILanguageServer> From(LanguageServerOptions options)
 {
     return(From(options, CancellationToken.None));
 }
 public static Task <LanguageServer> From(LanguageServerOptions options, IServiceProvider outerServiceProvider) =>
 From(options, outerServiceProvider, CancellationToken.None);
Ejemplo n.º 19
0
 public static LanguageServerOptions OnStarted(this LanguageServerOptions options, OnLanguageServerStartedDelegate @delegate)
 {
     options.Services.AddSingleton(@delegate);
     return(options);
 }
 public static Task <LanguageServer> From(LanguageServerOptions options) => From(options, null, CancellationToken.None);
Ejemplo n.º 21
0
 public static LanguageServerOptions ConfigureConfiguration(this LanguageServerOptions options, Action <IConfigurationBuilder> builderAction)
 {
     options.ConfigurationBuilderAction = builderAction;
     return(options);
 }
Ejemplo n.º 22
0
 public static LanguageServerOptions ConfigureLogging(this LanguageServerOptions options, Action <ILoggingBuilder> builderAction)
 {
     options.LoggingBuilderAction = builderAction;
     return(options);
 }
 public static LanguageServer Create(LanguageServerOptions options, IServiceProvider outerServiceProvider) =>
 CreateContainer(options, outerServiceProvider).Resolve <LanguageServer>();
 public static LanguageServer Create(LanguageServerOptions options) => Create(options, null);
 internal static IContainer CreateContainer(LanguageServerOptions options, IServiceProvider outerServiceProvider) =>
 JsonRpcServerContainer.Create(outerServiceProvider)
 .AddLanguageServerInternals(options, outerServiceProvider);
Ejemplo n.º 26
0
 public static LanguageServerOptions AddDefaultLoggingProvider(this LanguageServerOptions options)
 {
     options.AddDefaultLoggingProvider = true;
     return(options);
 }
Ejemplo n.º 27
0
 public static LanguageServerOptions WithRequestProcessIdentifier(this LanguageServerOptions options, IRequestProcessIdentifier requestProcessIdentifier)
 {
     options.RequestProcessIdentifier = requestProcessIdentifier;
     return(options);
 }
 public static Task <LanguageServer> From(LanguageServerOptions options, CancellationToken cancellationToken) => From(options, null, cancellationToken);
 /// <summary>
 /// Create the server without connecting to the client
 ///
 /// Mainly used for unit testing
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static LanguageServer PreInit(LanguageServerOptions options) => Create(options);
Ejemplo n.º 30
0
 public static LanguageServerOptions WithConfigurationItem(this LanguageServerOptions options, ConfigurationItem configurationItem)
 {
     options.Services.AddSingleton(configurationItem);
     return(options);
 }