Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function createDebugEngine(DATA_ROOT, LANGUAGE_SERVER_ROOT, LANGUAGE_SERVER_WORKSPACE, config) {
if (!fs.isDirectorySync(DATA_ROOT)) {
throw new Error(`${DATA_ROOT} doesn't exist.`);
}
if (!fs.isDirectorySync(LANGUAGE_SERVER_ROOT)) {
throw new Error(`${LANGUAGE_SERVER_ROOT} doesn't exist.`);
}
const promise1 = startDebugServer(DATA_ROOT);
mkdirp.sync(LANGUAGE_SERVER_WORKSPACE);
startLS(LANGUAGE_SERVER_ROOT, LANGUAGE_SERVER_WORKSPACE);
const port = parseInt(await promise1);
await promise1;
const dc = new DebugClient('java');
await dc.start(port);
const engine = new DebugEngine(DATA_ROOT, dc, {
"cwd": DATA_ROOT,
"startupClass": config.mainClass,
"classpath": path.join(DATA_ROOT, config.outputPath),
"sourcePath": [
path.join(DATA_ROOT, config.sourcePath)
]
});
config.withEngine(engine);
dc.on('terminated', (event) => {
engine.handleEvent('terminated').then(() => {
engine.promiseResolve('terminated');
});
});
dc.on('output', event => {