This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| 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(); |