Skip to content

Feature Request: Support for custom perlcritic verbosity strings in Diagnostic Hovers #186

Description

@adefaria

The Problem

Currently, Perl Navigator appears to "sanitize" or truncate the output from perlcritic before displaying it in the VS Code hover and Problems tab. While core Perl pragmas (like strict) render full documentation nicely, Perl::Critic violations are reduced to a single-line summary, even when the user has configured a detailed, verbose string in their .perlcriticrc.

For a team of developers, Perl::Critic is a vital teaching tool. We want to include the policy description (%d) and direct MetaCPAN links (https://metacpan.org/pod/Perl::Critic::Policy::%p) so developers can learn why a policy exists without hunting for documentation manually.

Current Behavior

In .perlcriticrc, I have:

verbose = %m [Policy: %p] | %d | Docs: https://metacpan.org/pod/Perl::Critic::Policy::%p

When running perlcritic in the terminal, the output is rich and includes the full description and URL. However, in VS Code, the hover only shows:

Critic: [Message] ([Policy], Severity: [X]) perlnavigator

The custom description and the URL are completely discarded by the LSP's diagnostic parser.

Desired Behavior

The Perl Navigator LSP should respect the verbose format defined in the user's .perlcriticrc (or passed via perlnavigator.critic.args) and display the entire resulting string in the VS Code Diagnostic message. This would allow:

  1. Clickable MetaCPAN links directly in the hover or Problems tab.
  2. In-editor education via the %d description string.

Example of what we want to see in the hover:

Subroutine "_log" does not end with "return" [Policy: Subroutines::RequireFinalReturn]
The last statement of every subroutine should be an explicit return statement. This makes the intended return value clear...
Docs: https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::RequireFinalReturn

Note: I'm using a Remote SSH environment on Amazon Linux

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions