Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

🐛 No link to rule documentation in LSP diagnostics #4092

Description

@rchl

Environment information

CLI:
  Version:              11.0.0
  Color support:        true

Platform:
  CPU Architecture:     aarch64
  OS:                   macos

What happened?

(It's not technically a bug, more a feature request but there is no relevant category for that during issue creation)

It would be useful to have a link to the documentation of the relevant rule for diagnostics reported when running in LSP mode. For example here we see a diagnostic specifying a rule name but we can't click the rule name to show more information about the rule.

Screenshot 2022-12-22 at 21 15 08

Here is an example of a different diagnostics from eslint with a documentation link:

Screenshot 2022-12-22 at 21 16 40

Expected result

Per LSP documentation, the Diagnostic object can specify codeDescription property which includes an URL. This can be used for this purpose and this is what eslint uses. For example:

{
  "diagnostics": [
    {
      "code": "space-in-parens",
      "codeDescription": {
        "href": "https://eslint.org/docs/rules/space-in-parens"
      },
      "message": "There should be no space before this paren.",
      "range": {
        "end": {
          "character": 41,
          "line": 1019
        },
        "start": {
          "character": 40,
          "line": 1019
        }
      },
      "severity": 1,
      "source": "eslint"
    }
  ],
  "uri": "...ts"
}

Code of Conduct

  • I agree to follow Rome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-To triageStatus: user report of a possible bug that needs to be triaged

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions