vscode
vscode copied to clipboard
CodeLens - Actual Command Not Found Error
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:
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:
- Use the sample CodeLens example.
- In the provider constructor, add:
setInterval(() => { this._onDidChangeCodeLenses.fire(); }, 5000); - In
resolveCodeLens, change the function toasyncand add:await new Promise((resolve) => setTimeout(resolve, 3000)); - Run the extension.
- Open a file which is scrollable.
- Wait for the CodeLens to show.
- Scroll down and wait 5 seconds.
- 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