Open yxshv opened 6 months ago
So I am trying to communicate with the tsserver and am trying to write to the tsserver stdin
tsserver
import { spawn } from 'child_process'; const { stdin: input, stdout: output } = spawn('./node_modules/.bin/tsserver', []); input.setDefaultEncoding('utf-8') setTimeout(start, 5000) output.pipe(process.stdout); const textDocument = { uri: 'file:///Users/balkrishnaverma/Documents/yash/testum/src/index.ts', languageId: 'typescript', version: 2, text: `type JustATest = { a: string, b: number } const abcd: Jus ` }; async function start() { input.cork() input.write(JSON.stringify({ seq: 0, type: "request", command: "open", arguments: { file: "/Users/balkrishnaverma/Documents/yash/testum/src/index.ts", fileContent: textDocument.text, projectRootPath: "/Users/balkrishnaverma/Documents/yash/testum", } })) input.uncork() }
but its not actually writing for some reason? when i pipe process.stdin.pipe(input) and type json from my terminal it works?
process.stdin.pipe(input)
{ node: '20.10.0', acorn: '8.10.0', ada: '2.7.2', ares: '1.20.1', base64: '0.5.0', brotli: '1.0.9', cjs_module_lexer: '1.2.2', cldr: '43.1', icu: '73.2', llhttp: '8.1.1', modules: '115', napi: '9', nghttp2: '1.57.0', nghttp3: '0.7.0', ngtcp2: '0.8.1', openssl: '3.0.12+quic', simdutf: '3.2.18', tz: '2023c', undici: '5.26.4', unicode: '15.0', uv: '1.46.0', uvwasi: '0.0.19', v8: '11.3.244.8-node.25', zlib: '1.2.13.1-motley' }
No response
MacOS
output of uname-a
uname-a
Darwin Balkrishnas-MacBook-Air.local 21.6.0 Darwin Kernel Version 21.6.0: Thu Jul 6 22:18:26 PDT 2023; root:xnu-8020.240.18.702.13~1/RELEASE_X86_64 x86_64
Not applicable.
Can you try adding a \n at the end of write?
I had tried that doesn't work
Is this issue still occuring? If not, feel free to self-close.
Details
So I am trying to communicate with the
tsserver
and am trying to write to thetsserver
stdinbut its not actually writing for some reason? when i pipe
process.stdin.pipe(input)
and type json from my terminal it works?Node.js version
Example code
No response
Operating system
MacOS
output of
uname-a
Module and version
Not applicable.