I would like to understand how to write long running code with VSCode API.
Currently I have VSCode command that takes a long time to execute:
subscriptions.push(vscode.commands.registerCommand("example.command", () => {
for (let i = 0; i < 1000000; i++) {
const j = i * i;
console.log("I'm blocking LSP");
}
}));
This command blocks the LSP features of the VSCode Editor while my code is running.
I found the similar question with great answer here: How to write async code with vscode api withProgress
But it looks like that child_process
module can not run a typescript
function in a new process and the only way to use it is to write separate application and communicate with it via stdin/stdout
.
Could you please tell me what is the correct way to write long running code in the vscode
command?
All your comments are greatly appreciated!