Ejemplo n.º 1
0
        public Server(CreationOptions creationOptions, Action <LanguageServerOptions> onOptionsFunc)
        {
            BicepDeploymentsInterop.Initialize();
            server = OmnisharpLanguageServer.PreInit(options =>
            {
                options
                .WithHandler <BicepTextDocumentSyncHandler>()
                .WithHandler <BicepDocumentSymbolHandler>()
                .WithHandler <BicepDefinitionHandler>()
                .WithHandler <BicepDeploymentGraphHandler>()
                .WithHandler <BicepReferencesHandler>()
                .WithHandler <BicepDocumentHighlightHandler>()
                .WithHandler <BicepDocumentFormattingHandler>()
                .WithHandler <BicepRenameHandler>()
                .WithHandler <BicepHoverHandler>()
                .WithHandler <BicepCompletionHandler>()
                .WithHandler <BicepCodeActionHandler>()
                .WithHandler <BicepDidChangeWatchedFilesHandler>()
                .WithHandler <BicepSignatureHelpHandler>()
                .WithHandler <BicepSemanticTokensHandler>()
                .WithHandler <BicepTelemetryHandler>()
                .WithHandler <BicepBuildCommandHandler>()
                .WithHandler <BicepDeployCommandHandler>()
                .WithHandler <BicepDeploymentScopeRequestHandler>()
                .WithHandler <BicepRegistryCacheRequestHandler>()
                .WithHandler <InsertResourceHandler>()
                .WithServices(services => RegisterServices(creationOptions, services));

                creationOptions.onRegisterServices?.Invoke(options.Services);

                onOptionsFunc(options);
            });
        }
Ejemplo n.º 2
0
        private Server(CreationOptions creationOptions, Action <LanguageServerOptions> onOptionsFunc)
        {
            BicepDeploymentsInterop.Initialize();
            server = OmniSharp.Extensions.LanguageServer.Server.LanguageServer.PreInit(options =>
            {
                options
                .WithHandler <BicepTextDocumentSyncHandler>()
                .WithHandler <BicepDocumentSymbolHandler>()
                .WithHandler <BicepDefinitionHandler>()
                .WithHandler <BicepDeploymentGraphHandler>()
                .WithHandler <BicepReferencesHandler>()
                .WithHandler <BicepDocumentHighlightHandler>()
                .WithHandler <BicepDocumentFormattingHandler>()
                .WithHandler <BicepRenameHandler>()
                .WithHandler <BicepHoverHandler>()
                .WithHandler <BicepCompletionHandler>()
                .WithHandler <BicepCodeActionHandler>()
                .WithHandler <BicepDidChangeWatchedFilesHandler>()
                .WithHandler <BicepSignatureHelpHandler>()
#pragma warning disable 0612 // disable 'obsolete' warning for proposed LSP feature
                .WithHandler <BicepSemanticTokensHandler>()
#pragma warning restore 0612
                .WithServices(services => RegisterServices(creationOptions, services));

                onOptionsFunc(options);
            });
        }
Ejemplo n.º 3
0
        public static async Task <int> Main(string[] args)
        {
            string profilePath = DirHelper.GetTempPath();

            ProfileOptimization.SetProfileRoot(profilePath);
            ProfileOptimization.StartProfile("bicep.profile");
            Console.OutputEncoding = TemplateEmitter.UTF8EncodingWithoutBom;

            BicepDeploymentsInterop.Initialize();

            if (FeatureProvider.TracingEnabled)
            {
                Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
            }

            // this event listener picks up SDK events and writes them to Trace.WriteLine()
            using (FeatureProvider.TracingEnabled ? AzureEventSourceListenerFactory.Create(FeatureProvider.TracingVerbosity) : null)
            {
                var program = new Program(new InvocationContext(
                                              new AzResourceTypeLoader(),
                                              Console.Out,
                                              Console.Error,
                                              features: null,
                                              clientFactory: null));

                // this must be awaited so dispose of the listener occurs in the continuation
                // rather than the sync part at the beginning of RunAsync()
                return(await program.RunAsync(args));
            }
        }
Ejemplo n.º 4
0
        public static int Main(string[] args)
        {
            BicepDeploymentsInterop.Initialize();
            var program = new Program(new AzResourceTypeProvider(), Console.Out, Console.Error);

            return(program.Run(args));
        }
Ejemplo n.º 5
0
        public static int Main(string[] args)
        {
            BicepDeploymentsInterop.Initialize();
            var program = new Program(AzResourceTypeProvider.CreateWithAzTypes(), Console.Out, Console.Error, ThisAssembly.AssemblyFileVersion);

            return(program.Run(args));
        }
Ejemplo n.º 6
0
        public static int Main(string[] args)
        {
            string profilePath = MulticoreJIT.GetMulticoreJITPath();

            ProfileOptimization.SetProfileRoot(profilePath);
            ProfileOptimization.StartProfile("bicep.profile");
            Console.OutputEncoding = TemplateEmitter.UTF8EncodingWithoutBom;

            BicepDeploymentsInterop.Initialize();

            var program = new Program(new InvocationContext(AzResourceTypeProvider.CreateWithAzTypes(), Console.Out, Console.Error, ThisAssembly.AssemblyFileVersion));

            return(program.Run(args));
        }
Ejemplo n.º 7
0
        public Server(CreationOptions creationOptions, Action <LanguageServerOptions> onOptionsFunc)
        {
            BicepDeploymentsInterop.Initialize();
            server = OmnisharpLanguageServer.PreInit(options =>
            {
                options
                .WithHandler <BicepTextDocumentSyncHandler>()
                .WithHandler <BicepDocumentSymbolHandler>()
                .WithHandler <BicepDefinitionHandler>()
                .WithHandler <BicepDeploymentGraphHandler>()
                .WithHandler <BicepReferencesHandler>()
                .WithHandler <BicepDocumentHighlightHandler>()
                .WithHandler <BicepDocumentFormattingHandler>()
                .WithHandler <BicepRenameHandler>()
                .WithHandler <BicepHoverHandler>()
                .WithHandler <BicepCompletionHandler>()
                .WithHandler <BicepCodeActionHandler>()
                .WithHandler <BicepCreateConfigFileHandler>()
                .WithHandler <BicepDidChangeWatchedFilesHandler>()
                .WithHandler <BicepEditLinterRuleCommandHandler>()
                .WithHandler <BicepGetRecommendedConfigLocationHandler>()
                .WithHandler <BicepSignatureHelpHandler>()
                .WithHandler <BicepSemanticTokensHandler>()
                .WithHandler <BicepTelemetryHandler>()
                .WithHandler <BicepBuildCommandHandler>()
                .WithHandler <BicepGenerateParamsCommandHandler>()
                .WithHandler <BicepDeploymentStartCommandHandler>()
                // Base handler - ExecuteTypedResponseCommandHandlerBase is serial. This blocks other commands on the client side.
                // To avoid the above issue, we'll change the RequestProcessType to parallel
                .WithHandler <BicepDeploymentWaitForCompletionCommandHandler>(new JsonRpcHandlerOptions()
                {
                    RequestProcessType = RequestProcessType.Parallel
                })
                .WithHandler <BicepDeploymentScopeRequestHandler>()
                .WithHandler <BicepDeploymentParametersHandler>()
                .WithHandler <BicepForceModulesRestoreCommandHandler>()
                .WithHandler <BicepRegistryCacheRequestHandler>()
                .WithHandler <InsertResourceHandler>()
                .WithServices(services => RegisterServices(creationOptions, services));

                creationOptions.onRegisterServices?.Invoke(options.Services);

                onOptionsFunc(options);
            });
        }
Ejemplo n.º 8
0
 public static void AssemblyInitialize(TestContext testContext)
 {
     BicepDeploymentsInterop.Initialize();
 }