Skip to content

Comment unindented after DU cases #2606

Closed

Description

@cmeeren

Issue created from fantomas-online

Code

type Frame =
    | A
    | B
    | C
    // TODO: Add D

Result

type Frame =
    | A
    | B
    | C
// TODO: Add D

Problem description

Seems similar to #1570, #2476, and #2482.

Options

Fantomas main branch at 2022-10-29T07:24:05Z - 767620c

Default Fantomas configuration

Activity

  1. dawedawe commented on Nov 3, 2022

    @dawedawe
    Member

    Hi Christer,
    thanks for bringing this up. I think the same pointers apply here like in the issues you mention.

  2. added a commit that references this issue on Mar 23, 2026
    1e758f3
  3. github-actions commented on Mar 23, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    This is caused by the same root cause as #2653 — trailing comments after the last DU case / match clause fall outside the TypeDefnUnionNode.Range, so the trivia-attachment algorithm falls back to attaching them at module level (indent = 0).

    A fix has been submitted (same PR as #2653). It uses a shallowest-first node search in Trivia.fs to find the enclosing TypeDefnUnionNode and attaches the comment at the correct indentation. All 2742 tests pass including a new regression test for this case.

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d
    
  4. added a commit that references this issue on Mar 23, 2026
    d715ddf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions