Ejemplo n.º 1
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>());
     }));
 }
Ejemplo n.º 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.ILanguageServer>(),
                    hostStartupInfo))
            .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>());
     }));
 }