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

Support extension debugging in a clean environment #159572

Closed
weinand opened this issue Aug 30, 2022 · 2 comments
Closed

Support extension debugging in a clean environment #159572

weinand opened this issue Aug 30, 2022 · 2 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues extensions-development Issues for developing extensions feature-request Request for new features or functionality on-testplan

Comments

@weinand
Copy link
Contributor

weinand commented Aug 30, 2022

In order to develop and debug extensions in a "clean environment", that means with a clean (or empty) set of extensions and settings, some users tried to use the --extensions-dir and --user-data-dir command line options in their extension's debug configuration.

Since this does not work, issues #126737 and #130504 were created.
Fixing these issues is difficult and would result in large and high-risk code changes.

With the recent work on "settings profiles", a much simpler solution is in reach.

This feature request will make profiles available for extension debugging in a clean environment.

@weinand weinand added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels Aug 30, 2022
@weinand weinand added this to the September 2022 milestone Aug 30, 2022
@weinand weinand self-assigned this Aug 30, 2022
@weinand weinand added the extensions-development Issues for developing extensions label Aug 30, 2022
@weinand
Copy link
Contributor Author

weinand commented Aug 30, 2022

With the "settings profile" feature and the new command line support for profiles it is now possible to specify profiles in the extension's debug configuration.

There are basically two possible approaches:

  • "debugging in a clean environment" by using an unnamed "empty" profile that gets automatically deleted when debugging has stopped.
  • "debugging in a controlled environment" by using a named profile that has been created specifically for extension debugging and contains specific 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}",
        "${workspaceFolder}/sampleWorkspace"
    ],
    "outFiles": [
        "${workspaceFolder}/dist/**/*.js"
    ],
    "preLaunchTask": "npm: watch"
}

Please note: the configuration from above passes a workspace folder ${workspaceFolder}/sampleWorkspace which is currently mandatory for the --profile-temp option. If the workspace folder argument is missing, the --profile-temp option is silently ignored. We will try to remove this requirement soon (see issue #159577).

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

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

@weinand
Copy link
Contributor Author

weinand commented Sep 8, 2022

With the fix for #159577 here is now an up-to-date description of the feature:


With the "settings profile" feature and the new command line support for profiles it is now possible to specify profiles in the extension's debug configuration.

There are basically two possible approaches:

  • "debugging in a clean environment" by using an unnamed "empty" profile that gets automatically deleted when debugging has stopped.
  • "debugging in a controlled environment" by using a named profile that has been created specifically for extension debugging and contains specific 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 "debug" profile:

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

Please note:
when using --profile-temp for debugging an extension in a remote location (via one of the "Remote Development" extensions, e.g. "Remote - SSH"), the remote VS Code instance will show 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. The workaround is to create an empty named profile, add the "Remote Development" extensions to it, and use the --profile=.... command line option.

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 extensions-development Issues for developing extensions feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests

1 participant