@influxdata/flux-lsp-cli
Advanced tools
Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "@influxdata/flux-lsp-cli", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Flux cli LSP server", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -32,3 +32,3 @@ #!/usr/bin/env node | ||
log = (msg) => { | ||
stream.write(msg) | ||
stream.write(msg.toString()) | ||
} | ||
@@ -40,9 +40,10 @@ } | ||
const respond = (data) => { | ||
if (argv.ipc) { | ||
const lines = data.split('\n') | ||
if (lines.length === 3) { | ||
process.send(JSON.parse(lines[2])) | ||
} | ||
} else { | ||
process.stdout.write(data) | ||
process.stdout.write(data) | ||
} | ||
const respondIPC = (data) => { | ||
const lines = data.split('\n') | ||
if (lines.length === 3) { | ||
process.send(JSON.parse(lines[2])) | ||
} | ||
@@ -52,8 +53,4 @@ } | ||
const handleInput = (data) => { | ||
let input = data | ||
const input = data.toString() | ||
if (argv.ipc) { | ||
input = `\n\n${JSON.stringify(input)}` | ||
} | ||
log(`REQUEST: ${input}\n`) | ||
@@ -75,6 +72,22 @@ | ||
const handleIPC = (data) => { | ||
const input = `\n\n${JSON.stringify(data)}` | ||
const resp = server.process(input) | ||
const msg = resp.get_message() | ||
if (msg) { | ||
log(`RESPONSE: ${msg}\n`) | ||
respondIPC(msg) | ||
} | ||
const err = resp.get_error() | ||
if (err) { | ||
log(`ERROR: ${err}\n`) | ||
} | ||
} | ||
if (argv.ipc) { | ||
process.on('message', handleInput) | ||
process.on('message', handleIPC) | ||
} else { | ||
process.stdin.on('data', handleInput) | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1878400
16
6217
1