VSCode LSP - display notifications

Viewed 17

Working on an LSP extension (for vscode), I'm trying to show arbitrary progress bars as notifications, initiated by the Server. As I understand, the server needs to send a "window/workDoneProgress/create" request followed by "$/progress" notifications.

After many failed attempts, I'm trying to do so with the simple sendRequest and sendNotification (also tried with sendProgress).

Here's the code

  const token = "token"; // random string

  await connection.sendRequest("window/workDoneProgress/create", {
    token,
  });

  await delay(1000);
  const dataB: WorkDoneProgressBegin = {
    kind: "begin",
    title: "Loading",
    message: "loading",
    percentage: 0,
  };
  await connection.sendNotification("$/progress", { token, value: dataB });

  await delay(1000);
  const dataR: WorkDoneProgressReport = {
    kind: "report",
    message: "still loading",
    percentage: 50,
  };
  await connection.sendNotification("$/progress", { token, value: dataR });

  await delay(1000);
  const dataE: WorkDoneProgressEnd = {
    kind: "end",
  };
  await connection.sendNotification("$/progress", { token, value: dataE });

The notifications/requests are well sent and received, no error in console, but I don't see the progress notification.

What am I missing? Do I need to set anything in the client?

Edit:

If I click on the bell in the status bar I can see the notification, but I'd like it to be pushed to the user, is it a vscode setting? enter image description here

0 Answers
Related