Example #1
0
File: main.js Project: d0f/.vscode
 connection.onRequest(protocol_1.InitializeRequest.type, (params) => {
     if (Is.number(params.processId)) {
         // We received a parent process id. Set up a timer to periodically check
         // if the parent is still alive.
         setInterval(() => {
             try {
                 process.kill(params.processId, 0);
             }
             catch (ex) {
                 // Parent process doesn't exist anymore. Exit the server.
                 process.exit(shutdownReceived ? 0 : 1);
             }
         }, 3000);
     }
     if (Is.string(params.trace)) {
         tracer.trace = vscode_jsonrpc_1.Trace.fromString(params.trace);
     }
     if (initializeHandler) {
         let result = initializeHandler(params, new vscode_jsonrpc_1.CancellationTokenSource().token);
         return asThenable(result).then((value) => {
             if (value instanceof vscode_jsonrpc_1.ResponseError) {
                 return value;
             }
             let result = value;
             if (!result) {
                 result = { capabilities: {} };
             }
             let capabilities = result.capabilities;
             if (!capabilities) {
                 capabilities = {};
                 result.capabilities = {};
             }
             if (!Is.number(capabilities.textDocumentSync)) {
                 capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : protocol_1.TextDocumentSyncKind.None;
             }
             return result;
         });
     }
     else {
         let result = { capabilities: { textDocumentSync: protocol_1.TextDocumentSyncKind.None } };
         return result;
     }
 });
Example #2
0
File: main.js Project: d0f/.vscode
 connection.onNotification(vscode_jsonrpc_1.SetTraceNotification.type, (params) => {
     tracer.trace = vscode_jsonrpc_1.Trace.fromString(params.value);
 });