Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createLSConnection(ballerinaHome: string) : LangServerProcessConnection {
const childProcess = createServer(ballerinaHome);
childProcess.on('error', (err) => {
// log('Error while starting LS', err);
});
const reader = new StreamMessageReader(childProcess.stdout);
const writer = new StreamMessageWriter(childProcess.stdin);
const messageConntection = createMessageConnection(reader, writer);
const errorHandler: ConnectionErrorHandler = (err, msg, count) => {
// log('Error while starting LS', err);
};
const closeHandler: ConnectionCloseHandler = () => {
// log('LS Connection closed');
};
const lsConnection = createConnection(messageConntection, errorHandler, closeHandler);
return {
childProcess,
lsConnection
}
}