From 07989ad16482394525f210ef51ee5f9f8e71c17b Mon Sep 17 00:00:00 2001 From: Robert Grosse Date: Mon, 24 Feb 2025 09:07:10 -0800 Subject: [PATCH] Make scipDependencyOrder a full ordering 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 --- glean/lang/lsif/Data/LSIF/Gen.hs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/glean/lang/lsif/Data/LSIF/Gen.hs b/glean/lang/lsif/Data/LSIF/Gen.hs index e9d61dc4f..5e752dbaf 100644 --- a/glean/lang/lsif/Data/LSIF/Gen.hs +++ b/glean/lang/lsif/Data/LSIF/Gen.hs @@ -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 @@ -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