예제 #1
0
        public LanguageServer(IRPCServer rpcServer)
        {
            this.rpcServer = rpcServer;
            rpcServer.RegisterRequestMethod(CodeActionRequest.Type, CallCodeAction);
            rpcServer.RegisterRequestMethod(CodeLensRequest.Type, CallCodeLens);
            rpcServer.RegisterRequestMethod(CodeLensResolveRequest.Type, CallCodeLensResolve);
            rpcServer.RegisterRequestMethod(CompletionRequest.Type, CallCompletion);
            rpcServer.RegisterRequestMethod(CompletionResolveRequest.Type, CallCompletionResolve);
            rpcServer.RegisterRequestMethod(DocumentHighlightRequest.Type, CallDocumentHighlight);
            rpcServer.RegisterRequestMethod(DocumentSymbolRequest.Type, CallDocumentSymbol);
            rpcServer.RegisterRequestMethod(DocumentFormattingRequest.Type, CallDocumentFormatting);
            rpcServer.RegisterRequestMethod(DocumentOnTypeFormattingRequest.Type, CallDocumentOnTypeFormatting);
            rpcServer.RegisterRequestMethod(DocumentRangeFormattingRequest.Type, CallDocumentRangeFormatting);
            rpcServer.RegisterRequestMethod(DefinitionRequest.Type, CallDefinition);
            rpcServer.RegisterRequestMethod(HoverRequest.Type, CallHoverRequest);
            rpcServer.RegisterRequestMethod(InitializeRequest.Type, CallInitialize);
            rpcServer.RegisterRequestMethod(ReferencesRequest.Type, CallReferences);
            rpcServer.RegisterRequestMethod(RenameRequest.Type, CallRename);
            rpcServer.RegisterRequestMethod(ShutdownRequest.Type, CallShutdown);
            rpcServer.RegisterRequestMethod(SignatureHelpRequest.Type, CallSignatureHelp);
            rpcServer.RegisterRequestMethod(WorkspaceSymbolRequest.Type, CallWorkspaceSymbol);
            rpcServer.RegisterNotificationMethod(DidChangeConfigurationNotification.Type, CallDidChangeConfiguration);
            rpcServer.RegisterNotificationMethod(ExitNotification.Type, CallExit);
            rpcServer.RegisterNotificationMethod(DidChangeWatchedFilesNotification.Type, CallDidChangeWatchedFiles);
            rpcServer.RegisterNotificationMethod(DidChangeTextDocumentNotification.Type, CallDidChangeTextDocument);
            rpcServer.RegisterNotificationMethod(DidCloseTextDocumentNotification.Type, CallDidCloseTextDocument);
            rpcServer.RegisterNotificationMethod(DidOpenTextDocumentNotification.Type, CallDidOpenTextDocument);
            rpcServer.RegisterNotificationMethod(DidSaveTextDocumentNotification.Type, CallDidSaveTextDocument);

            RemoteConsole = new RemoteConsole(rpcServer);
            RemoteWindow  = new RemoteWindow(rpcServer);
        }
예제 #2
0
 private void CallDidSaveTextDocument(NotificationType notificationType, object parameters)
 {
     try
     {
         OnDidSaveTextDocument((DidSaveTextDocumentParams)parameters);
     }
     catch (Exception e)
     {
         RemoteConsole.Error(String.Format("Error while handling notification {0} : {1}", notificationType.Method, e.Message));
     }
 }
예제 #3
0
 private void CallDidChangeWatchedFiles(NotificationType notificationType, object parameters)
 {
     try
     {
         OnDidChangeWatchedFiles((DidChangeWatchedFilesParams)parameters);
     }
     catch (Exception e)
     {
         NotifyException(e);
         RemoteConsole.Error(String.Format("Error while handling notification {0} : {1}", notificationType.Method, e.Message));
     }
 }
예제 #4
0
 private void CallExit(NotificationType notificationType, object parameters)
 {
     try
     {
         OnExit();
     }
     catch (Exception e)
     {
         RemoteConsole.Error(String.Format("Error while handling notification {0} : {1}", notificationType.Method, e.Message));
     }
     finally
     {
         if (shutdownReceived)
         {
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(1);
         }
     }
 }