microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.15k stars 28.83k forks source link

Code Lenses stop working when opening an editor in preview mode #202185

Closed robertohuertasm closed 8 months ago

robertohuertasm commented 8 months ago

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

Can't tell as when I disable all the extensions I don't get any code lens. But I've tried Bisect and couldn't point to any particular extension.

Steps to Reproduce:

I have uploaded a video as it's better to see it in action. Basically, code lenses command gets inactive once we open a new file in preview mode, and then we come back to the previous editor. Here, 2 things can happen:

  1. If the lens had been clicked, it can disappear.
  2. If the lens had not been clicked, it will be inactive.

Note that this will affect all the lenses in the document. Not only one.

If we close the preview editor instead of navigating back to the original one, code lenses will be recomputed and the bug will be gone. Same happens if we modify the document. This will cause a recomputation and lenses will work as expected.

For what I've seen, this may be related to #198309

https://github.com/microsoft/vscode/assets/696981/07cf9efc-859d-40ce-8591-7b3a1baac151

Let me know if you need more information. I'll be glad to help you.

jrieken commented 8 months ago

Please enable trace logging (F1 > Set Log Level) and check the EH logs (F1 > Show Logs > Extension Host). When switching tab we keep a "disconnected" copy of lenses and when switching back we show them while asking for the "real" lenses. I suspect the extension fails to resolve/re-validate lenses or is slow to do so

robertohuertasm commented 8 months ago

I'm not sure what to look for. I've attached a copy of my extension logs while reproducing the issue. Hope it helps: exthost.log

robertohuertasm commented 8 months ago

Hi @jrieken, not sure if you need anything else from my side. Let me know if that's the case.

jrieken commented 8 months ago

The attached logs didn't reveal anything... Maybe give me a longer section but my theory is still that this is an issue with the extension. During my daily development I selfhost on code-lenses (from different extensions) I have never seens this

VSCodeTriageBot commented 8 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

Med-H commented 6 months ago

This bug i happening in VSCode 1.87.2. it's annnoying. I think the video show exactly how to reproduce the bug. at least on macos. Can someone reopen this bug ?

thanks in advance.

ggobbe commented 5 months ago

Been having this bug since around November 2023. I use the Jest Runner and REST Client extensions that rely on code lenses to run actions.

In both cases, the code lens becomes unactionable quite often. I couldn't link it to a webview being opened, it also happens without any webview opened.

To fix it, I switch to another tab then back to the original file, and it becomes actionable again.