This repository has been archived by the owner. It is now read-only.
Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 430 Bytes
var prettier = require('prettier');
var rpc = require('vscode-jsonrpc');
var connection = rpc.createMessageConnection(
new rpc.StreamMessageReader(process.stdin),
new rpc.StreamMessageWriter(process.stdout)
);
connection.onRequest('format', (content, options) => {
try {
return {error: null, formatted: prettier.format(content, options)};
} catch(e) {
return {error: e.toString()};
}
});
connection.listen();