vscode icon indicating copy to clipboard operation
vscode copied to clipboard

CodeLens - Actual Command Not Found Error

Open GuyB-Hud opened this issue 1 year ago • 0 comments

We are developing an extension using CodeLensProvider, and we want to refresh our lenses every 5 seconds. To achieve this, we use onDidChangeCodeLenses and fire it with setInterval.

After onDidChangeCodeLenses runs, and resolveCodeLens doesn't respond fast enough, the following error pops up:

image

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.92.2
  • OS Version: Darwin arm64 23.4.0

Steps to Reproduce:

  1. Use the sample CodeLens example.
  2. In the provider constructor, add: setInterval(() => { this._onDidChangeCodeLenses.fire(); }, 5000);
  3. In resolveCodeLens, change the function to async and add: await new Promise((resolve) => setTimeout(resolve, 3000));
  4. Run the extension.
  5. Open a file which is scrollable.
  6. Wait for the CodeLens to show.
  7. Scroll down and wait 5 seconds.
  8. Scroll back up and click on a lens (faster than 3 seconds).

https://github.com/user-attachments/assets/5c4a9e6d-efce-4272-a225-07e686cc622f

Changing scheduler.schedule() in this line to this._onModelChange() fixed it for me, although I'm not sure that's the correct solution because it makes the lens unclickable. Would appreciate your support

GuyB-Hud avatar Aug 28 '24 07:08 GuyB-Hud