Trigger a Command on frontend #1324
Replies: 2 comments 1 reply
-
Hey @vibsid0986, for both of these, you likely need the same mechanism. I assume your frontend is a language client, like vscode? In that case, it's just enough to send a notification to the language client from your language server that indicates that the generation has finished/is still ongoing. // On generator finished/updated
connection.sendNotification('generator/progress'); Then on the client side, you can invoke the vscode API to display a notification/invoke a command: languageClient.onNotification('generator/progress', () => {
vscode.commands.executeCommand('<name-of-command>');
}); The progress report would work similar, but it would also send the progress value as an argument for the notification. |
Beta Was this translation helpful? Give feedback.
-
Hi @msujew , Thanks for your quick response. It was really very helpful and I was able to implement it successfully, however in case of progress bar, seems like for every file processed it will invoke the command again and again, which would not be ideal. I am currently sending progress with the number of files processed as parameter through sendNotification from worker thread to main. Can you help me with a way to handle progress for such scenario. |
Beta Was this translation helpful? Give feedback.
-
Hello Team,
Below are my queries, request you to provide assistance on them.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions