Skip to content

Support (and document) launch config debuggerType": 0 for both number and string #5855

Closed

Description

@dcharkes

Given a workspace for the Dart SDK and the following lauch configurations for the debugger

	"launch": {
		"version": "0.2.0",
		"configurations": [
                         {
				"name": "dart pkg/compiler/test/record_use/record_use_test.dart",
				"type": "dart",
				"request": "launch",
				"program": "pkg/compiler/test/record_use/record_use.dart", // works as expected
				// "program": "pkg/compiler/test/record_use/record_use_dart.dart", // doesn't
				"args": [
					"types_of_arguments",
				],
				"cwd": "${workspaceFolder}",
			},

The behavior is different based on file name. It runs package test if the file is ending in test.dart even though this file has nothing to with package test. Leading to a crash that it cannot find a suite with such name.

Did we add some logic to simplify running tests in the debugger from launch configurations?

If yes, can we fix the heuristics? Or get a way to disable it?

Screenshots
If applicable, add screenshots to help explain your problem.

Please complete the following information:

You can run the Dart: Collect Diagnostic Information command from the VS Code command palette (F1) to easily capture this information or provide it manually.

  • Operating System and version:
  • VS Code version:
  • Dart extension version:
  • Dart/Flutter SDK version:
  • Target device (if the issue relates to Flutter debugging):

Activity

  1. DanTup commented on Dec 23, 2025

    @DanTup
    Member
    // "program": "pkg/compiler/test/record_use/record_use_dart.dart", // doesn't
    

    I presume this is a typo, and you mean record_use_test.dart?

    The behavior is different based on file name. It runs package test if the file is ending in test.dart even though this file has nothing to with package test.

    If something is inside a test folder and ends with _test.dart we assume it's a test file:

    export function isTestFile(file: string): boolean {
    // To be a test, you must be _test.dart AND inside a test folder (unless allowTestsOutsideTestFolder).
    // https://github.com/Dart-Code/Dart-Code/issues/1165
    // https://github.com/Dart-Code/Dart-Code/issues/2021
    // https://github.com/Dart-Code/Dart-Code/issues/2034
    return !!file && isDartFile(file)
    && (
    isInsideFolderNamed(file, "test")
    || isInsideFolderNamed(file, "integration_test")
    || isInsideFolderNamed(file, "test_driver")
    || config.allowTestsOutsideTestFolder
    )
    && file.toLowerCase().endsWith("_test.dart");
    }

    If yes, can we fix the heuristics?

    I'm not sure I understand the change you're proposing. Are you suggesting to examine the file contents and try to infer whether it really is a test? That would require parsing (something we can't do in the extension) and might break test-wrapping packages like package:test_reflective_loader.

    If this is just a one-off, we do now support overriding the debugger type (see #5535). Generally my preference is to improve heuristics where we can, but this might be a case where it's better to just override.

  2. added
    awaiting infoRequires more information from the customer to progress
    and removed on Dec 23, 2025
  3. dcharkes commented on Dec 23, 2025

    @dcharkes
    Author

    Thanks for the lightspeed reply! 🙏

    Ah yes, it's a typo. ☕ 🙃

    Overriding would solve my issue. How to use it? "DebuggerType" seems to not be a valid field?

    			{
    				"name": "dart pkg/compiler/test/record_use/record_use_test.dart",
    				"type": "dart",
    				"request": "launch",
    				"program": "pkg/compiler/test/record_use/record_use_test.dart",
    				"args": [
    					"types_of_arguments",
    				],
    				"cwd": "${workspaceFolder}",
    				"debuggerType": 0,
    			},
  4. DanTup commented on Dec 23, 2025

    @DanTup
    Member

    How to use it? "DebuggerType" seems to not be a valid field?

    Oh, it's possible I didn't add it to the manifest (in which case, VS Code doesn't know it's valid, but it will still work). The original request was from another extension so it wasn't being coded directly into launch.json.

    So, just try it anyway and ignore the VS Code warning. If it works, we can use this issue for adding it to the manifest with some docs.

  5. dcharkes commented on Dec 23, 2025

    @dcharkes
    Author

    Yep it works, without LoadException (Failed to load "types_of_arguments": Does not exist.), with it works as expected 🙏

    Thanks @DanTup! One step ahead of me! 🚀

  6. changed the title [-]Running a dart script ending in `test.dart` cannot be run as non-test[/-] [+][doc] Document launch config `debuggerType": 0,`[/+] on Dec 23, 2025
  7. changed the title [-][doc] Document launch config `debuggerType": 0,`[/-] [+][doc] Document launch config `debuggerType": 0`[/+] on Dec 23, 2025
  8. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed
    awaiting infoRequires more information from the customer to progress
    on Dec 23, 2025
  9. added this to the v3.126.0 milestone on Dec 23, 2025
  10. DanTup commented on Dec 23, 2025

    @DanTup
    Member

    Great, I'll add it to the manifest with suitable docs. Maybe we should make it a string enum so you get better autocomplete/values (but still support the numbers too, since we assign the enum values to it internally).

  11. modified the milestones: v3.126.0, v3.128.0 on Dec 29, 2025
  12. changed the title [-][doc] Document launch config `debuggerType": 0`[/-] [+]Support (and document) launch config `debuggerType": 0` for both number and string[/+] on Dec 29, 2025
  13. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    in docs / websiteRelates to documentation, including the Dart Code website
    on Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin docs / websiteRelates to documentation, including the Dart Code websiteis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions