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

feat(doctor): add in explanations to the json doctor output #3494

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

ckipp01
Copy link
Member

@ckipp01 ckipp01 commented Jan 11, 2022

This is a follow-up to the work done in
#3426.

This extracts out the explanation logic into the DoctorExplanation ADT
so that we can re-use it both for html and for json.

The old output of the json doctor was:

{
  "title": "Metals Doctor",
  "headerText": "Build server currently being used is Bloop v1.4.11.\n\nThese are the installed build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.",
  "version": 1,
  "targets": [
    {
      "buildTarget": "Sanity",
      "targetType": "Scala 2.12.15",
      "diagnostics": "",
      "interactive": "",
      "semanticdb": "",
      "debugging": "",
      "java": "",
      "recommendation": ""
    },
    {
      "buildTarget": "Sanity.test",
      "targetType": "Scala 2.12.15",
      "diagnostics": "",
      "interactive": "",
      "semanticdb": "",
      "debugging": "",
      "java": "",
      "recommendation": ""
    }
  ]
}

Where now the new format for the same build would be:

{
  "title": "Metals Doctor",
  "headerText": "Build server currently being used is Bloop v1.4.11.\n\nThese are the installed build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.",
  "version": 1,
  "targets": [
    {
      "buildTarget": "Sanity",
      "targetType": "Scala 2.12.15",
      "diagnostics": "",
      "interactive": "",
      "semanticdb": "",
      "debugging": "",
      "java": "",
      "recommendation": ""
    },
    {
      "buildTarget": "Sanity.test",
      "targetType": "Scala 2.12.15",
      "diagnostics": "",
      "interactive": "",
      "semanticdb": "",
      "debugging": "",
      "java": "",
      "recommendation": ""
    }
  ],
  "explanations": [
    {
      "title": "Diagnostics:",
      "explanations": [
        "✅  - diagnostics correctly being reported by the build server"
      ]
    },
    {
      "title": "Interactive features (completions, hover):",
      "explanations": [
        "✅  - supported Scala version"
      ]
    },
    {
      "title": "Semanticdb features (references, renames, go to implementation):",
      "explanations": [
        "✅  - build tool automatically creating needed semanticdb files"
      ]
    },
    {
      "title": "Debugging (run/test, breakpoints, evaluation):",
      "explanations": [
        "✅  - users can run or test their code with debugging capabilities"
      ]
    },
    {
      "title": "Java Support:",
      "explanations": [
        "✅  - working non-interactive features (references, rename etc.)"
      ]
    }
  ]
}

This is a follow-up to the work done in
scalameta#3426.

This extracts out the explanation logic into `DoctorExplanation` ADT to
so that we can re-use it both for html and for json.

The old output of the json doctor was:

```json
{
  "title": "Metals Doctor",
  "headerText": "Build server currently being used is Bloop v1.4.11.\n\nThese are the installed build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.",
  "version": 1,
  "targets": [
    {
      "buildTarget": "Sanity",
      "targetType": "Scala 2.12.15",
      "diagnostics": "✅ ",
      "interactive": "✅ ",
      "semanticdb": "✅ ",
      "debugging": "✅ ",
      "java": "✅ ",
      "recommendation": ""
    },
    {
      "buildTarget": "Sanity.test",
      "targetType": "Scala 2.12.15",
      "diagnostics": "✅ ",
      "interactive": "✅ ",
      "semanticdb": "✅ ",
      "debugging": "✅ ",
      "java": "✅ ",
      "recommendation": ""
    }
  ]
}
````

Where now the new format for the same build would be:

```json
{
  "title": "Metals Doctor",
  "headerText": "Build server currently being used is Bloop v1.4.11.\n\nThese are the installed build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.",
  "version": 1,
  "targets": [
    {
      "buildTarget": "Sanity",
      "targetType": "Scala 2.12.15",
      "diagnostics": "✅ ",
      "interactive": "✅ ",
      "semanticdb": "✅ ",
      "debugging": "✅ ",
      "java": "✅ ",
      "recommendation": ""
    },
    {
      "buildTarget": "Sanity.test",
      "targetType": "Scala 2.12.15",
      "diagnostics": "✅ ",
      "interactive": "✅ ",
      "semanticdb": "✅ ",
      "debugging": "✅ ",
      "java": "✅ ",
      "recommendation": ""
    }
  ],
  "explanations": [
    {
      "title": "Diagnostics:",
      "explanations": [
        "✅  - diagnostics correctly being reported by the build server"
      ]
    },
    {
      "title": "Interactive features (completions, hover):",
      "explanations": [
        "✅  - supported Scala version"
      ]
    },
    {
      "title": "Semanticdb features (references, renames, go to implementation):",
      "explanations": [
        "✅  - build tool automatically creating needed semanticdb files"
      ]
    },
    {
      "title": "Debugging (run/test, breakpoints, evaluation):",
      "explanations": [
        "✅  - users can run or test their code with debugging capabilities"
      ]
    },
    {
      "title": "Java Support:",
      "explanations": [
        "✅  - working non-interactive features (references, rename etc.)"
      ]
    }
  ]
}

```
Copy link
Member

@dos65 dos65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ckipp01 ckipp01 merged commit 6efba18 into scalameta:main Jan 12, 2022
@ckipp01 ckipp01 deleted the drJson branch January 12, 2022 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants