Skip to content
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

Test extension debugging in a clean environment #160905

Closed
3 tasks done
weinand opened this issue Sep 14, 2022 · 2 comments
Closed
3 tasks done

Test extension debugging in a clean environment #160905

weinand opened this issue Sep 14, 2022 · 2 comments
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item

Comments

@weinand
Copy link
Contributor

weinand commented Sep 14, 2022

Refs: #159572

Complexity: 2

Authors: @weinand, @sandy081

Create Issue


When debugging an extension, there was always the problem that the extension was running in the development environment (user settings and installed extensions) of the author of the extension and not in an environment that was more appropriate for the target user of the extension.

With the recently introduced "profiles" feature it is now possible to run the extension under development in a different environment by specifying a profile in the extension's debug configuration.

Two scenarios are supported:

  • "debugging in a clean environment" by using an unnamed "empty" profile that gets automatically deleted when extension debugging has stopped.
  • "debugging in a controlled environment" by using a named profile that has been created specifically for the extension under development, and that contains specific user settings and extensions.

This debug configuration shows how to "debug in a clean environment":

{
    "name": "Extension",
    "type": "extensionHost",
    "request": "launch",
    "args": [
        "--profile-temp",
        "--extensionDevelopmentPath=${workspaceFolder}"
    ],
    "outFiles": [
        "${workspaceFolder}/dist/**/*.js"
    ],
    "preLaunchTask": "npm: watch"
}

And here is a debug configuration for "debugging in a controlled environment" that uses a previously created profile named "extensionContext":

{
    "name": "Extension",
    "type": "extensionHost",
    "request": "launch",
    "args": [
        "--profile=extensionContext",
        "--extensionDevelopmentPath=${workspaceFolder}"
    ],
    "outFiles": [
        "${workspaceFolder}/dist/**/*.js"
    ],
    "preLaunchTask": "npm: watch"
}

Known limitation:
when debugging an extension in a remote location (via the "Remote Development" extensions "Containers", "SSL", or "WSL"), using the --profile-temp flag will result in this status message:

2022-09-08_11-46-47

This is expected because the temporary profile does not include any extensions, which means that the "Remote Development" extensions are missing too. For remote scenarios it is recommended to create an empty named profile, add the "Remote Development" extensions to it, and then use the --profile=.... command line option.


Please verify for your favourite extension...

  • that the "--profile-temp" and "--profile=" command lines flags work for the two scenarios from above.
  • that the "--profile=" flag works in a remote setup of your choice (SSH, WSL, Container).
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item labels Sep 14, 2022
@weinand weinand added this to the September 2022 milestone Sep 14, 2022
@ghost ghost assigned digitarald, hediet and andreamah Sep 27, 2022
@hediet
Copy link
Member

hediet commented Sep 27, 2022

Nice work! Maybe the sample extensions should be updated to use this.

@hediet hediet removed their assignment Sep 27, 2022
@andreamah andreamah removed their assignment Sep 27, 2022
@rzhao271 rzhao271 assigned rzhao271 and unassigned digitarald and rzhao271 Sep 29, 2022
@rzhao271
Copy link
Contributor

This is a pretty cool use of profiles 🎉

@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item
Projects
None yet
Development

No branches or pull requests

5 participants