-
Notifications
You must be signed in to change notification settings - Fork 302
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
Bug with debug autoAttach in dev containers #5516
Comments
@connor4312 Rebuilding probably deletes the initial copy. Is there a way to trigger copying that again? |
Only if we can activate the extension somehow. I think rebuilding should clear the terminal environment variable collection since anything put in there may not longer be applicable or reference correctly in the rebuilt container @Tyriar |
@connor4312 instead of referencing workspaceStorage, can you make a bootloader entry point in the (stable) extension install directory instead and have that do the detection/installation? |
Copying to the workspace folder was done in microsoft/vscode-js-debug@3056cb8 since the path of the extension folder for the nightly extension changes daily. We could use the install folder for only the non-nightly extension and just accept that this bug will happen using nightly, which is kind of spooky but would solve the issue. |
@Tyriar It seems |
Right now only the extension can modify its own |
The resolver could return a machine id that changes when the container changes. I guess, you could then flush all Since this is the only issue that has come up in this regard, I'm also open to add a simple workaround to Remote-Containers. Thinking about this, I wonder: How does the extension make sure the environment variable is set when it does not activate on/after startup in a new workspace? Should it activate |
Its environment variables are persisted over reloads without requiring activation to be set in a given window -- since the user can create terminals before activation happens. |
Does such a concept exist yet? Does core know that machines may differ for remotes? |
I see the built-in
That would be new. |
I guess what we want then is a eg. it could use the regular workspace storage key when machine isn't set, but if the remote extension sets it, it could be |
There is also StorageTarget.MACHINE, maybe that already covers this. What's a bit special is that the 'machine' is new after a rebuild, but it is usually still very similar to the previous one, so I guess there might also be advantages to keeping some of the StorageTarget.MACHINE values. (E.g., if the open editors are stored using that.) @connor4312 Before we dive in more on a general solution, couldn't the following check also check if the bootloader.js exists and if not activate |
The environment variables are necessarily set by js-debug, since it needs to know the location of the bootloader and apply settings to the environment variables. The API doesn't allow extensions to see each others' environment variable collections, so |
Another solution would be for variable resolution to support fetching an extension's directory, like |
For this we need to start consuming extensions in the variable resolver. If we want to do this globally, then I think we'd want to:
The alternative would be saying that we only support this in the limited scope of terminal environment variables, which would let us create a more focused change to inject extension information only when resolving terminal environment variables. Thoughts @sandy081? |
@alexdima owns IExtensionService. |
I like the suggestion from @Tyriar for supporting @connor4312 sorry, I'm not sure I follow your comment. AFAIK variable resolution for remote terminals is done on the renderer process, because remote terminals are launched from the server process. I'm not sure I understand where the need to split the |
It looks like extension resolution only happens in the extension host as part of the |
This allows us to fix microsoft/vscode-remote-release#5516 (comment) It enables a new replacement in the format `${extensionDir:<id>}` which will expand to the filesystem path where the extension is stored. This involved churn, since now resolution is always synchronous (where before the terminal took a synchronous-only path.) Additionally, changes were needed to inject this information in the variable resolver. As part of this I made the extension host resolver (used by debug and tasks) its own extension host service.
This allows us to fix microsoft/vscode-remote-release#5516 (comment) It enables a new replacement in the format `${extensionDir:<id>}` which will expand to the filesystem path where the extension is stored. This involved churn, since now resolution is always synchronous (where before the terminal took a synchronous-only path.) Additionally, changes were needed to inject this information in the variable resolver. As part of this I made the extension host resolver (used by debug and tasks) its own extension host service.
* variables: allow resolving `extensionDir` This allows us to fix microsoft/vscode-remote-release#5516 (comment) It enables a new replacement in the format `${extensionDir:<id>}` which will expand to the filesystem path where the extension is stored. This involved churn, since now resolution is always synchronous (where before the terminal took a synchronous-only path.) Additionally, changes were needed to inject this information in the variable resolver. As part of this I made the extension host resolver (used by debug and tasks) its own extension host service. * fixup! preserve object key order in resolution, add extensionDir support * fixup! address pr comments * fixup! address pr comments * fixup! address pr comments * config: fix config replacement only working for first variable per line * fixup! fix unit tests
Steps to Reproduce:
Get a devcontainer with Node, for example https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/javascript-node-postgres
settings
field indevcontainer.json
:"debug.javascript.autoAttachFilter": "smart"
.There are several similar bugs at the VS Code repository, just linking one for now: microsoft/vscode#98778
Feel free to move this to the VS Code repository if it fits better there.
To make auto attach working I can do
Debug: Toggle Auto Attach
from the command palette and toggle it off and on again, but that defeats the purpose of having it set as a default setting in thedevcontainer.json
😊The text was updated successfully, but these errors were encountered: