Skip to content

Commit

Permalink
Make scipDependencyOrder a full ordering
Browse files Browse the repository at this point in the history
Summary:
Make scipDependencyOrder a full ordering to ensure consistent output format. This will hopefully make it easier to compare output between different versions of the code to check for regressions.

Not sure where SymbolKind and Metadata "should" go, but they're currently ordered at the bottom, so I put them at the bottom.

Also fix some typos in a comment.

Reviewed By: donsbot

Differential Revision: D70018768

fbshipit-source-id: 27e8e8de8b825ed24de0f7aa469dc13f6e56fffd
  • Loading branch information
Robert Grosse authored and facebook-github-bot committed Feb 24, 2025
1 parent 22ff053 commit 07989ad
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions glean/lang/lsif/Data/LSIF/Gen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ insertPredicateMap = foldl' ins

-- | Given a hashmap keyed by lsif predicate names, emit an array of json
-- pred/facts with one entry per predicate. In case we have very large
-- predicats, we chunk them into smaller top level groups, which makes memory
-- predicates, we chunk them into smaller top level groups, which makes memory
-- mgmt a bit easier
generateJSON :: PredicateMap -> [Value]
generateJSON = mkGenerateJSON lsifSchemaVersion lsifDependencyOrder

-- | Given a hashmap keyed by scip redicate names, emit an array of json
-- | Given a hashmap keyed by scip predicate names, emit an array of json
-- pred/facts with one entry per predicate. In case we have very large
-- predicats, we chunk them into smaller top level groups, which makes memory
-- predicates, we chunk them into smaller top level groups, which makes memory
-- mgmt a bit easier
generateSCIPJSON :: PredicateMap -> [Value]
generateSCIPJSON = mkGenerateJSON scipSchemaVersion scipDependencyOrder
Expand Down Expand Up @@ -175,17 +175,19 @@ lsifDependencyOrder p = case p of
--
scipDependencyOrder :: Text -> Int
scipDependencyOrder p = case p of
"src.File" -> 0
"scip.Range" -> 0
"scip.Symbol" -> 0
"scip.LocalName" -> 0
"scip.Documentation" -> 0
"scip.FileLanguage" -> 1 -- refers to src.File
"scip.FileRange" -> 2 -- refers to src.File and scip.Range
"scip.Definition" -> 3
"scip.Reference" -> 3
"scip.SymbolDocumentation" -> 3
"scip.SymbolName" -> 3
"src.File" -> 01
"scip.Range" -> 02
"scip.Symbol" -> 03
"scip.LocalName" -> 04
"scip.Documentation" -> 05
"scip.FileLanguage" -> 11 -- refers to src.File
"scip.FileRange" -> 21 -- refers to src.File and scip.Range
"scip.Definition" -> 31
"scip.Reference" -> 32
"scip.SymbolDocumentation" -> 33
"scip.SymbolName" -> 34
"scip.SymbolKind" -> 41
"scip.Metadata" -> 42
_ -> 100

data MonikerKind = Export | Local | Import | Implementation
Expand Down

0 comments on commit 07989ad

Please sign in to comment.