public static IServiceCollection AddPsesLanguageServices(
     this IServiceCollection collection,
     HostStartupInfo hostStartupInfo)
 {
     return(collection.AddSingleton <WorkspaceService>()
            .AddSingleton <SymbolsService>()
            .AddSingleton <ConfigurationService>()
            .AddSingleton <PowerShellContextService>(
                (provider) =>
                PowerShellContextService.Create(
                    provider.GetService <ILoggerFactory>(),
                    // NOTE: Giving the context service access to the language server this
                    // early is dangerous because it allows it to start sending
                    // notifications etc. before it has initialized, potentially resulting
                    // in deadlocks. We're working on a solution to this.
                    provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServerFacade>(),
                    hostStartupInfo))
            .AddSingleton <TemplateService>() // TODO: What's the difference between this and the TemplateHandler?
            .AddSingleton <EditorOperationsService>()
            .AddSingleton <RemoteFileManagerService>()
            .AddSingleton <ExtensionService>(
                (provider) =>
     {
         var extensionService = new ExtensionService(
             provider.GetService <PowerShellContextService>(),
             // NOTE: See above warning.
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServerFacade>());
         extensionService.InitializeAsync(
             serviceProvider: provider,
             editorOperations: provider.GetService <EditorOperationsService>())
         .Wait();
         return extensionService;
     })
            .AddSingleton <AnalysisService>());
 }
예제 #2
0
 public static IServiceCollection AddPsesLanguageServices(
     this IServiceCollection collection,
     HostStartupInfo hostStartupInfo)
 {
     return(collection.AddSingleton <WorkspaceService>()
            .AddSingleton <SymbolsService>()
            .AddSingleton <ConfigurationService>()
            .AddSingleton <PowerShellContextService>(
                (provider) =>
                PowerShellContextService.Create(
                    provider.GetService <ILoggerFactory>(),
                    provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServerFacade>(),
                    hostStartupInfo))
            .AddSingleton <TemplateService>()
            .AddSingleton <EditorOperationsService>()
            .AddSingleton <RemoteFileManagerService>()
            .AddSingleton <ExtensionService>(
                (provider) =>
     {
         var extensionService = new ExtensionService(
             provider.GetService <PowerShellContextService>(),
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServerFacade>());
         extensionService.InitializeAsync(
             serviceProvider: provider,
             editorOperations: provider.GetService <EditorOperationsService>())
         .Wait();
         return extensionService;
     })
            .AddSingleton <AnalysisService>());
 }
예제 #3
0
 public static IServiceCollection AddPsesLanguageServices(
     this IServiceCollection collection,
     ProfilePaths profilePaths,
     HashSet <string> featureFlags,
     bool enableConsoleRepl,
     bool useLegacyReadLine,
     PSHost internalHost,
     HostDetails hostDetails,
     string[] additionalModules)
 {
     return(collection.AddSingleton <WorkspaceService>()
            .AddSingleton <SymbolsService>()
            .AddSingleton <ConfigurationService>()
            .AddSingleton <PowerShellContextService>(
                (provider) =>
                PowerShellContextService.Create(
                    provider.GetService <ILoggerFactory>(),
                    provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>(),
                    profilePaths,
                    featureFlags,
                    enableConsoleRepl,
                    useLegacyReadLine,
                    internalHost,
                    hostDetails,
                    additionalModules))
            .AddSingleton <TemplateService>()
            .AddSingleton <EditorOperationsService>()
            .AddSingleton <RemoteFileManagerService>()
            .AddSingleton <ExtensionService>(
                (provider) =>
     {
         var extensionService = new ExtensionService(
             provider.GetService <PowerShellContextService>(),
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>());
         extensionService.InitializeAsync(
             serviceProvider: provider,
             editorOperations: provider.GetService <EditorOperationsService>())
         .Wait();
         return extensionService;
     })
            .AddSingleton <AnalysisService>(
                (provider) =>
     {
         return AnalysisService.Create(
             provider.GetService <ConfigurationService>(),
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>(),
             provider.GetService <ILoggerFactory>().CreateLogger <AnalysisService>());
     }));
 }