Skip to content

Commit a9c9ad4

Browse files
committed
doc: updated docs
1 parent 59cdb29 commit a9c9ad4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/utils/server.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ function createTSServerInstance() {
1212
const pendingCommands = new Map();
1313

1414
/**
15-
* Initializes the TypeScript Server process.
15+
* Initializes the TypeScript Server instance.
16+
*
17+
* This function starts a new process for the TypeScript Server using Node's `child_process.spawn`.
18+
* It sets up listeners for the 'stdout' and 'stderr' streams of the TypeScript Server process,
19+
* handling incoming data and errors respectively. It also handles the 'close' event of the process.
20+
* The function configures a timeout to reject the promise if the server does not start within a specified time.
21+
*
22+
* @param {string} [node=""] - The path to the Node.js executable. If not provided, defaults to 'node'.
23+
* @param {string} [tsServer=""] - The path to the TypeScript Server executable. If not provided,
24+
* defaults to the 'tsserver' path in the 'node_modules' directory.
25+
* @returns {Promise<void>} A promise that resolves when the TypeScript Server is ready,
26+
* or rejects if there is an error or timeout.
1627
*/
1728
function initTSServer(node = "", tsServer = "") {
1829
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)