-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode.executeCodeLensProvider sometimes only contains the range and not title/commands #79805
Comments
Oh, seems like this has come up before - though marked as fixed for 1.36 (this is happening in both 1.37.1 and insiders):
@jrieken is it expected that there are still races here and this is a bug, or is it known to still have issues? |
We have a great developer community over on slack where extension authors help each other. This is a great place for you to ask questions and find support. Happy Coding! |
It depends on |
@jrieken there are only 4 code lens items - why would I need more than 50? |
Actually, that's not quite accurate - there are 28 when I run locally (I filter them to the ones I care about, which is 2-4). I'll try increasing it to see if the issue goes away - though is it expected that resolve matters here anyway if the provide does not use resolve and always returns the full object? |
Well, that's all I can speculate given the lack of a code sample that reliability reproduces this. |
@jrieken seems it's not that, as I bumped it to 500 and still see the failure. I tweaked the log to include the count as well as the full response. I appreciate it's hard to debug something that's intermittent, but it seems like there's a bug. Is there anything more I can do to help track it down?
|
Yeah, providing an extension that reproduces this 🤓 The command implementation is pretty simple, calling into provide/resolve which I have confidence that they are working |
Here: https://github.com/DanTup/vscode-repro-79805 It's a very basic project that creates a code lens provider that returns 30 items with commands. There's a test that runs 20 times that just calls for the code lens, with Here are results on Travis (it's intermittent on Travis, and I haven't seen it at all locally): https://travis-ci.org/DanTup/vscode-repro-79805/builds/577285247
I don't use |
Thanks. I can reproduce, weirdly when running the unit test as command it always happens on the last run. It never happens when not having arguments to the command, so this is likely an issue with how we cache command arguments |
I'm not sure how it'd know it's the last run, but glad you can repro! Let me know if you need anything more or want me to test a fix. |
This is the backstory: When having code lens with commands with arguments we don't serialise the arguments but we create command-placeholders (using the same UX properties) that behind the scenes invoke the 'real' command. That helps to prevent sending unnecessary data around and helps in cases the data cannot be serialised at all. The (internal) code lens API manages the lifecycle, e.g. there is |
Turns out that also |
This isn't very nice but instead of disposing via |
This is related to/the better fix for #75208 |
Thanks for the digging! I just saw a similar failure in code actions in my tests, but looking at your change, I think that had the same issue and now has the same workaround now too?
|
yeah, very likely the same issue |
I've started seeing intermittent failures in some of my code-lens tests like "command doesn't exist on undefined".
I added some debug logging, and have discovered that sometimes the results from
vscode.executeCodeLensProvider
contain only arange
and no other confirmation.Here's what my test code looks like:
And it's printing this sometimes:
The ranges match up with what I expect from the provider (and I get the expected count), but there's no way my provider can return ranges without commands - the code looks like this:
It's not consistent - these results show it failed for 1 of 4 tests on macOS, but passed on Windows and Linux:
I've run the tests repeatedly locally but cannot reproduce (it's on Travis where I see it mostly). It feels like a race condition, but I can't figure out why. I don't use
resolve
, but I tried passing 50 for the number of items to resolve, but it hasn't helped.The text was updated successfully, but these errors were encountered: