File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -398,6 +398,10 @@ indexHieFile writer HieIndexerOptions{..} path hie = do
398398 let fileLines = mkFileLines filefact offs
399399 Glean. makeFact_ @ Src. FileLines fileLines
400400
401+ when storeSrc $
402+ Glean. makeFactV_ @ Src. FileContent filefact $
403+ Text. decodeUtf8Lenient (hie_hs_src hie)
404+
401405 Glean. makeFact_ @ Hs. ModuleSource $
402406 Hs. ModuleSource_key modfact filefact
403407
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ data HieIndexerOptions = HieIndexerOptions
3636 -- ^ Prefix to add to source paths
3737 , unitName :: UnitName
3838 -- ^ How to handle unit names
39+ , storeSrc :: Bool
40+ -- ^ Whether to store the indexed source in src.FileContent
3941 , verbosity :: Int
4042 }
4143
@@ -82,6 +84,10 @@ options = info (helper <*> parser) fullDesc
8284 metavar " PATH" <>
8385 help " Prefix to add to source paths in the DB" ))
8486
87+ storeSrc <- switch (
88+ long " store-src" <>
89+ help " Store the full source file in src.FileContent" )
90+
8591 unitName <- option (maybeReader parseUnit) (
8692 long " unit" <>
8793 metavar " key|id" <>
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ predicate File : string
88# Source code digests produced by unspecified hash function
99predicate FileDigest : File -> string
1010
11+ # Source code content (if the indexer stored it)
12+ predicate FileContent : File -> string
13+
1114# Common source code location type
1215type Loc = {
1316 file : File,
You can’t perform that action at this time.
0 commit comments