Skip to content

Commit 58b0db0

Browse files
committed
Clean up file annotations again
1 parent 7416ce8 commit 58b0db0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

unison-cli/src/Unison/Codebase/Editor/HandleInput/FormatFile.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ formatFile makePPEDForFile formattingWidth currentPath inputParsedFile inputType
8282
& over _2 Pretty.syntaxToColor
8383
formattedTerms <-
8484
(FileSummary.termsBySymbol fileSummary)
85-
& Map.filter (\(_bindingAnn, _, trm, _) -> shouldFormatTerm (ABT.annotation trm) trm)
86-
& itraverse \sym (_bindingAnn, mayRefId, trm, _typ) -> do
85+
& fmap (\(bindingAnn, mayRefId, trm, _typ) -> (bindingAnn <> ABT.annotation trm, mayRefId, trm))
86+
& Map.filter (\(tldAnn, _, trm) -> shouldFormatTerm tldAnn trm)
87+
& itraverse \sym (tldAnn, mayRefId, trm) -> do
8788
symName <- hoistMaybe (Name.parseVar sym)
8889
let defNameSegments = NEL.appendr (Path.toList (Path.unabsolute currentPath)) (Name.segments symName)
8990
let defName = Name.fromSegments defNameSegments
@@ -102,7 +103,7 @@ formatFile makePPEDForFile formattingWidth currentPath inputParsedFile inputType
102103
-- Pretty.syntaxToColor $ Pretty.string wk <> "> " <> TermPrinter.prettyBindingWithoutTypeSignature definitionPPE hqName (stripTypeAnnotation trm)
103104
-- (Just wk, _) -> Pretty.string wk <> "> " <> TermPrinter.prettyBlock False definitionPPE (stripTypeAnnotation trm)
104105
-- (Nothing, _) -> "> " <> TermPrinter.prettyBlock False definitionPPE (stripTypeAnnotation trm)
105-
pure (ABT.annotation trm, formattedTerm)
106+
pure (tldAnn, formattedTerm)
106107

107108
-- Only keep definitions which are _actually_ in the file, skipping generated accessors
108109
-- and such.

unison-cli/src/Unison/LSP/FoldingRange.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ foldingRangesForFile UnisonFileId {dataDeclarationsId, effectDeclarationsId, ter
4949
terms
5050
& Map.toList
5151
<&> \case
52-
(sym, (_ann, trm)) -> (Just sym, ABT.annotation trm)
52+
(sym, (varAnn, trm)) -> (Just sym, varAnn <> ABT.annotation trm)
5353
watchFolds =
5454
watches
5555
& fold
5656
& fmap
57-
( \(_sym, ann, _trm) ->
57+
( \(_sym, openAnn, trm) ->
5858
-- We don't use the symbol here because watch symbols are often auto-generated
5959
-- and ugly.
60-
(Nothing, ann)
60+
(Nothing, openAnn <> ABT.annotation trm)
6161
)
6262
folds =
6363
dataFolds <> abilityFolds <> termFolds <> watchFolds

0 commit comments

Comments
 (0)