VS代码语言服务器管道输出向客户端的子管道输出
我正在创建自己的语言服务器扩展。我已经将儿童程序的输出输送到控制台和扩展输出渠道。问题在于,运行儿童程序时的控制台输出更新,但仅在De ChildProcess关闭后才更新输出通道。您对如何解决此问题有建议吗?
这是我的代码的一部分:
let output = client.outputChannel
console.info("Start the sketch")
output.appendLine("Start the sketch")
let runProces = childProcess.spawn(command,
{cwd: workDir, shell: true, stdio: ['pipe', 'pipe', 'pipe']})
//Pipe childProcess output to extenstion output
runProces.stdout.on('data', data => {
console.log(`${data}`)
output.append(data.toString())
output.show();
})
runProces.stderr.on('data', (data) =>{
console.log(`${data}`)
})
runProces.on('close', (close) =>{
console.info(`Sketch ended`)
output.appendLine("Sketch ended")
})
I'm creating my own language-server extension. I've piped the output of a childprocess to the console and the extension outputChannel. The problem is that the console output updates while running the childprocess but the outputChannel updates only after de childprocess is closed. Do you have suggestions on how to fix this?
Here's part of my code:
let output = client.outputChannel
console.info("Start the sketch")
output.appendLine("Start the sketch")
let runProces = childProcess.spawn(command,
{cwd: workDir, shell: true, stdio: ['pipe', 'pipe', 'pipe']})
//Pipe childProcess output to extenstion output
runProces.stdout.on('data', data => {
console.log(`${data}`)
output.append(data.toString())
output.show();
})
runProces.stderr.on('data', (data) =>{
console.log(`${data}`)
})
runProces.on('close', (close) =>{
console.info(`Sketch ended`)
output.appendLine("Sketch ended")
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论