Skip to content

Add validation for configuration items of launch.json #355

Closed

Description

The debugger only has type validation for the config items (mainClass, projectName) of launch.json, this is a kind of static validation, and it cannot check the illegal value.

For example, for the common config errors below, the debugger will report it at a much latter stage with error message Failed to resolve classpath: .... It doesn't point out the failure reason clearly.

  • Main class 'C:\demo\org\microsoft\app\Main.java' doesn't exist in the workspace.
  • Main class 'org.microsoft.app.Main' isn't unique in the workspace.
  • The project 'demo' is not a valid java project.

In order to better remind the user about the config error with more concise error message, plan to add code validation in the debug configuration provider for the key configuration items. (e.g. mainClass, projectName, port)

Activity

  1. added this to the 0.12.0 milestone on Aug 7, 2018
  2. testforstephen commented on Aug 17, 2018

    @testforstephen
    ContributorAuthor

    So far VSCode doesn't support auto complete when the user is editing the launch.json. It provides another mechanism DebugConfigurationProvider to allow the debugger to resolve launch config before launching debug session.

    The idea is to validate mainClass and projectName config in the DebugConfigurationProvider, and when the user configured an incorrect value for these two configs, the debugger will prompt the possible correct configs with QuickPick dropdown. If the user selects the fix, the debugger will persist the fix in launch.json too.

  3. testforstephen commented on Aug 22, 2018

    @testforstephen
    ContributorAuthor

    When showing the quick fix proposals, put the proposals with the same name as the original mainClass or projectName configs in launch.json on the top, and the remaining proposals in alphabet order.

  4. testforstephen commented on Aug 28, 2018

    @testforstephen
    ContributorAuthor

    PR #368 and microsoft/java-debug#205 merged. It will be released in 0.12.0. close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions