-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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.extensions.getExtension("...").packageJSON gives the wrong value after a reload window #40500
Comments
This bug only repros on Windows (not on Linux or Mac). I don't know yet if this repros for all Windows machines or if there's a special requirement. |
@alexandrudima could this be related to your recent package.json work? |
This is highly unexpected. Why is this a requirement to have debugging work? Why would an extension rewrite its The root cause is our newly introduced caching of The cache includes user installed extensions (and not extensions under development), so running locally with I suggest two paths forward:
|
I assume someone on VS Code has to be aware of this, because the C/C++ and C# extensions have been doing this for a while (mostly due to the debugger).
Okay, thanks. I'll investigate modifying the extensions folder mtime. Some API for doing post-installation processing before real activation might solve this. Oh, I see, this started to repro on 1.19 -- my Linux/Mac testing was using 1.18.1 still, so the bug repros on Linux/Mac now. This is a scary change, because it executes a code path that was previously impossible to occur -- it actually runs our "offline installer" code, which thankfully seems to be benign, other than re-writing "Finished installing dependencies" when it shouldn't. |
@sean-mcmanus what exactly are the debugger contributions in package.json that you need to do post-install? |
You can see the changes in our javascript. This is code belonging to our debugger team (which also works on the C# extension), i.e. @pieandcakes . Without it, native debugging fails or C/C++ configuration snippets don't appear in the launch.json.
and
|
@sean-mcmanus the first part could be replaced by implementing the |
According to #34668, it sounds like dynamic configuration snippets was abandoned as "out-of-scope"? |
@alexandrudima Using fs.utime to modify the mtime of the extensions folder fixes the issue for us...that seems good enough to me. Thanks. |
@weinand |
@sean-mcmanus Thank you for going with the workaround (touching the @chrisdias @seanmcbreen Can we please reach out to the C# extension authors and let them know we're caching @weinand Should we leave this item for you to continue figuring out how to remove the need for patching |
@gregg-miskelly you might be affected by this issue as well. Please follow @alexandrudima 's suggestions. |
@WardenGnaw issues around the |
@sean-mcmanus fyi for the dynamic snippets I have commented here |
@weinand @gregg-miskelly is out until after the end of the year. The C# extension is tracking it via dotnet/vscode-csharp#1929 |
@isidorn A CompletionItemProvider looks like a form of Intellisense when the user types in |
@pieandcakes no, in general VSCode is moving towards the |
@weinand Was Isidorn's comment that you are referencing talking about using a |
Yes, I was refereing to the I just wanted to correct your misinterpretation that we are moving away from the |
@weinand Ok, I'll wait for his response then. My comment wasn't saying that you were moving away from |
@pieandcakes yes, it should work when the user presses the |
@isidorn Is this the correct DocumentSelector?
I am registering the CompletionItemProvider as Also would the CompletionItemKind be Snippet? |
@WardenGnaw looks good to me. Yes the Here is how we do it for our built in json extension https://github.com/Microsoft/vscode/blob/master/extensions/javascript/src/features/jsonContributions.ts#L39 fyi @jrieken to check if I am missing something here |
Triage: it seems that this issue is resolved? Can it be closed? |
I'm fine with closing this. |
Steps to Reproduce:
Bug: The value of vscode.extensions.getExtension("...").packageJSON is incorrect and doesn't match the value of the re-written package.json on disk. It gives back the old value, which causes our debugger to fail, because we need the re-written package.json values. Doing a 2nd reload window fixes the issue. This bug also does not repro when extension developers debug their code via Launch Extension, which is why we never noticed it before (i.e. it only starts to repro after installing a new vsix).
I don't think our extension can fix this -- we need VS Code to use the new package.json that we wrote to disk, although a far better solution would be to enable some preactivate scenario that does:
This would enable a seeemless experience for users requiring 0 extra reloads. With this bug, users have to do 2 extra reloads (a simple fix of the bug would require 1 extra reload).
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: