Skip to content

Commit

Permalink
futhark fmt: strip trailing whitespace from comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Nov 7, 2024
1 parent dc26885 commit 4c3920d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Futhark/Fmt/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ sepLine s = sep (s <> space <|> hardline <> s)
comment :: T.Text -> Fmt
comment c = do
modify (\s -> s {lastOutput = Just Line})
pure $ P.annotate commentStyle (P.pretty c) <> P.line
pure $ P.annotate commentStyle (P.pretty (T.stripEnd c)) <> P.line

-- In order to handle trailing comments its VERY important to
-- evaluate the seperator after each element in the list.
Expand Down
2 changes: 1 addition & 1 deletion tests_fmt/comment.fut
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- -p '/Comparing Tokens of uniqueness\/uniqueness6.fut/'
-- continuing

-- another comment
-- another comment

def f x = x + 2

Expand Down

0 comments on commit 4c3920d

Please sign in to comment.