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

Multiline comments shifted to the right #4

Open
deemp opened this issue Jun 14, 2023 · 0 comments
Open

Multiline comments shifted to the right #4

deemp opened this issue Jun 14, 2023 · 0 comments

Comments

@deemp
Copy link
Owner

deemp commented Jun 14, 2023

Multiline comments may appear in indented blocks such as class instances.

It is possible to prevent fourmolu from shifting the multiline comments to the right.

{- FOURMOLU_DISABLE -}

{-
\begin{listing}[!h]
  \begin{minted}{haskell}
-}

instance Num Coords where
  (+) :: Coords -> Coords -> Coords
  (+) Coords{_row = r1, _col = c1, ..} Coords{_row = r2, _col = c2} = Coords{_row = r1 + r2, _col = c1 + c2, ..}
--  ... other instance functions ...

{-
\end{minted}
  \caption{Num instance for Coords}
  \label{coordinates:numCoords}
\end{listing}
-}

{- FOURMOLU_ENABLE -}

TODO

  • disable only what's not necessary
  • allow comments in minted
{-
\end{minted}
-}
{- FOURMOLU_DISABLE -}
{-
  \caption{Num instance for Coords}
  \label{coordinates:numCoords}
\end{listing}
-}
{- FOURMOLU_ENABLE -}

However, it may be better to recognize multiline comments even if they're shifted.

  {-
  \end{minted}
    \caption{Num instance for Coords}
    \label{coordinates:numCoords}
  \end{listing}
  -}

The question is, how to restore their indentation afterwards.

@deemp deemp changed the title Hard cases Multiline comments shifted to the right Jun 14, 2023
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

No branches or pull requests

1 participant