Skip to content

💡 Make file path truncation in the default symbols reporter configurable (or disable it by default) #1704

@barrymichaeldoyle

Description

@barrymichaeldoyle

Suggest an idea for Knip

Prerequisites

  • I'm using the latest version
  • I've searched for existing issues

Description

I’m raising this as a follow-up to #1494.

The change there improved the default symbols reporter by truncating file paths from the left instead of the right, which is definitely better. But for local terminal/editor workflows, the underlying issue still feels unresolved: file paths are still truncated automatically based on terminal width.

This is a problem because the default symbols reporter is the nicest human-readable output, but truncating file paths makes it harder to act on the results directly.

A common workflow in VS Code/Cursor is:

  • run knip in the integrated terminal
  • alt/option click the file:line:col location to jump straight to the issue

When the path is truncated, that workflow breaks or becomes unreliable, especially in smaller terminal panes.

Current behavior

The default symbols reporter truncates file paths to fit terminal width.

This is understandable for compact display, but it means diagnostic locations are no longer always fully available in the output.

Expected behaviour

I think one of these would be ideal:

  1. Add a config/CLI option to disable file path truncation in the symbols reporter.
  2. Or, avoid truncating diagnostic file paths by default in the symbols reporter.
  3. Or at minimum, preserve the full file:line:col location while still allowing other columns to be truncated.

Why this matters

The default reporter is excellent for humans, but diagnostics are most useful when they are directly actionable.

For local development, I’d personally prefer long lines / soft wrapping over truncating file paths, because:

  • terminals already handle wrapping
  • editor-integrated terminals often support click-to-open
  • full paths are more important than strict table width

Preference

My personal preference would be:

  • default: do not truncate diagnostic file paths in symbols
  • fallback: if that’s not desirable as a default, please add a config or reporter option to disable truncation

Something along the lines of:

  • truncateFilePath: false
  • reporterOptions for symbols
  • or a more general table/reporter truncation setting

Additional note

I’m aware other reporters exist, but the default symbols reporter is the most pleasant one to use interactively, which is why this feels worth improving there specifically.

I'm happy to make a PR if a decision is made on the best path forward for this 😁

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    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