Skip to content

Instantly share code, notes, and snippets.

@smarr
Created July 6, 2016 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarr/79c1a5e90c9a13659f38597e44caa568 to your computer and use it in GitHub Desktop.
Save smarr/79c1a5e90c9a13659f38597e44caa568 to your computer and use it in GitHub Desktop.
VS Code Language Protocol Proxy
'use strict';
var vscode = require('vscode-languageserver');
const target = process.argv[2]; // the actual language server protocol implementation
const spawn = require('child_process').spawn;
const p = spawn(target, []);
const writer = new vscode.StreamMessageWriter(p.stdin);
process.on('message', (m) => { writer.write(m); });
const reader = new vscode.StreamMessageReader(p.stdout);
reader.listen((m) => { process.send(m); });
p.on('close', (code) => {
process.exit(code);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment