1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

This is no longer necessary

This commit is contained in:
Timothy Clem 2019-03-29 07:59:33 -07:00
parent 48a11d88e8
commit c8083a0470
4 changed files with 4 additions and 18 deletions

View File

@ -153,7 +153,6 @@ message Blob {
string content = 1; string content = 1;
string path = 2; string path = 2;
string language = 3; string language = 3;
string oid = 4;
} }
message BlobPair { message BlobPair {
@ -166,7 +165,6 @@ message File {
string language = 2; string language = 2;
repeated Symbol symbols = 3; repeated Symbol symbols = 3;
repeated ParseError errors = 4; repeated ParseError errors = 4;
string blob_oid = 5;
} }
message Symbol { message Symbol {

View File

@ -97,8 +97,8 @@ instance APIBridge T.Text Data.Language where
instance APIBridge API.Blob Data.Blob where instance APIBridge API.Blob Data.Blob where
bridging = iso apiBlobToBlob blobToApiBlob where bridging = iso apiBlobToBlob blobToApiBlob where
blobToApiBlob Data.Blob{..} = API.Blob (toText blobSource) (T.pack blobPath) (bridging # blobLanguage) blobOid blobToApiBlob Data.Blob{..} = API.Blob (toText blobSource) (T.pack blobPath) (bridging # blobLanguage)
apiBlobToBlob API.Blob{..} = Data.Blob (fromText content) (T.unpack path) (language ^. bridging) oid apiBlobToBlob API.Blob{..} = Data.Blob (fromText content) (T.unpack path) (language ^. bridging) mempty
instance APIConvert API.BlobPair Data.BlobPair where instance APIConvert API.BlobPair Data.BlobPair where

View File

@ -65,7 +65,7 @@ parseSymbols blobs = ParseTreeSymbolResponse . V.fromList . toList <$> distribut
go :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Blob -> m File go :: (Member (Error SomeException) sig, Member Task sig, Carrier sig m) => Blob -> m File
go blob@Blob{..} = (doParse blob >>= withSomeTerm (renderToSymbols blob)) `catchError` (\(SomeException e) -> pure $ errorFile (show e)) go blob@Blob{..} = (doParse blob >>= withSomeTerm (renderToSymbols blob)) `catchError` (\(SomeException e) -> pure $ errorFile (show e))
where where
errorFile e = File (pack blobPath) (bridging # blobLanguage) mempty (V.fromList [ParseError (T.pack e)]) blobOid errorFile e = File (pack blobPath) (bridging # blobLanguage) mempty (V.fromList [ParseError (T.pack e)])
symbolsToSummarize :: [Text] symbolsToSummarize :: [Text]
symbolsToSummarize = ["Function", "Method", "Class", "Module", "Call", "Send"] symbolsToSummarize = ["Function", "Method", "Class", "Module", "Call", "Send"]
@ -74,7 +74,7 @@ parseSymbols blobs = ParseTreeSymbolResponse . V.fromList . toList <$> distribut
renderToSymbols blob@Blob{..} term = pure $ either (errorFile . show) (tagsToFile blob) (runTagging blob symbolsToSummarize term) renderToSymbols blob@Blob{..} term = pure $ either (errorFile . show) (tagsToFile blob) (runTagging blob symbolsToSummarize term)
tagsToFile :: Blob -> [Tag] -> File tagsToFile :: Blob -> [Tag] -> File
tagsToFile Blob{..} tags = File (pack blobPath) (bridging # blobLanguage) (V.fromList (fmap tagToSymbol tags)) mempty blobOid tagsToFile Blob{..} tags = File (pack blobPath) (bridging # blobLanguage) (V.fromList (fmap tagToSymbol tags)) mempty
tagToSymbol :: Tag -> Symbol tagToSymbol :: Tag -> Symbol
tagToSymbol Tag{..} tagToSymbol Tag{..}

View File

@ -1019,7 +1019,6 @@ data Blob = Blob
{ content :: Text { content :: Text
, path :: Text , path :: Text
, language :: Text , language :: Text
, oid :: Text
} deriving stock (Eq, Ord, Show, Generic) } deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (Proto3.Named, NFData) deriving anyclass (Proto3.Named, NFData)
@ -1028,7 +1027,6 @@ instance FromJSONPB Blob where
<$> obj .: "content" <$> obj .: "content"
<*> obj .: "path" <*> obj .: "path"
<*> obj .: "language" <*> obj .: "language"
<*> obj .: "oid"
instance ToJSONPB Blob where instance ToJSONPB Blob where
toJSONPB Blob{..} = object toJSONPB Blob{..} = object
@ -1036,14 +1034,12 @@ instance ToJSONPB Blob where
"content" .= content "content" .= content
, "path" .= path , "path" .= path
, "language" .= language , "language" .= language
, "oid" .= oid
] ]
toEncodingPB Blob{..} = pairs toEncodingPB Blob{..} = pairs
[ [
"content" .= content "content" .= content
, "path" .= path , "path" .= path
, "language" .= language , "language" .= language
, "oid" .= oid
] ]
instance FromJSON Blob where instance FromJSON Blob where
@ -1059,13 +1055,11 @@ instance Proto3.Message Blob where
encodeMessageField 1 content encodeMessageField 1 content
, encodeMessageField 2 path , encodeMessageField 2 path
, encodeMessageField 3 language , encodeMessageField 3 language
, encodeMessageField 4 oid
] ]
decodeMessage _ = Blob decodeMessage _ = Blob
<$> at decodeMessageField 1 <$> at decodeMessageField 1
<*> at decodeMessageField 2 <*> at decodeMessageField 2
<*> at decodeMessageField 3 <*> at decodeMessageField 3
<*> at decodeMessageField 4
dotProto = undefined dotProto = undefined
data BlobPair = BlobPair data BlobPair = BlobPair
@ -1114,7 +1108,6 @@ data File = File
, language :: Text , language :: Text
, symbols :: Vector Symbol , symbols :: Vector Symbol
, errors :: Vector ParseError , errors :: Vector ParseError
, blobOid :: Text
} deriving stock (Eq, Ord, Show, Generic) } deriving stock (Eq, Ord, Show, Generic)
deriving anyclass (Proto3.Named, NFData) deriving anyclass (Proto3.Named, NFData)
@ -1124,7 +1117,6 @@ instance FromJSONPB File where
<*> obj .: "language" <*> obj .: "language"
<*> obj .: "symbols" <*> obj .: "symbols"
<*> obj .: "errors" <*> obj .: "errors"
<*> obj .: "blobOid"
instance ToJSONPB File where instance ToJSONPB File where
toJSONPB File{..} = object toJSONPB File{..} = object
@ -1133,7 +1125,6 @@ instance ToJSONPB File where
, "language" .= language , "language" .= language
, "symbols" .= symbols , "symbols" .= symbols
, "errors" .= errors , "errors" .= errors
, "blobOid" .= blobOid
] ]
toEncodingPB File{..} = pairs toEncodingPB File{..} = pairs
[ [
@ -1141,7 +1132,6 @@ instance ToJSONPB File where
, "language" .= language , "language" .= language
, "symbols" .= symbols , "symbols" .= symbols
, "errors" .= errors , "errors" .= errors
, "blobOid" .= blobOid
] ]
instance FromJSON File where instance FromJSON File where
@ -1158,14 +1148,12 @@ instance Proto3.Message File where
, encodeMessageField 2 language , encodeMessageField 2 language
, encodeMessageField 3 (Proto3.NestedVec symbols) , encodeMessageField 3 (Proto3.NestedVec symbols)
, encodeMessageField 4 (Proto3.NestedVec errors) , encodeMessageField 4 (Proto3.NestedVec errors)
, encodeMessageField 5 blobOid
] ]
decodeMessage _ = File decodeMessage _ = File
<$> at decodeMessageField 1 <$> at decodeMessageField 1
<*> at decodeMessageField 2 <*> at decodeMessageField 2
<*> (nestedvec <$> at decodeMessageField 3) <*> (nestedvec <$> at decodeMessageField 3)
<*> (nestedvec <$> at decodeMessageField 4) <*> (nestedvec <$> at decodeMessageField 4)
<*> at decodeMessageField 5
dotProto = undefined dotProto = undefined
data Symbol = Symbol data Symbol = Symbol