mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Merge branch 'master' into go-assignment
This commit is contained in:
commit
017b511469
@ -54,9 +54,9 @@ readBlobsFromHandle = fmap toBlobs . readFromHandle
|
||||
readFromHandle :: (FromJSON a, MonadIO m) => Handle -> m a
|
||||
readFromHandle h = do
|
||||
input <- liftIO $ BL.hGetContents h
|
||||
case decode input of
|
||||
Just d -> pure d
|
||||
Nothing -> liftIO $ die ("invalid input on " <> show h <> ", expecting JSON")
|
||||
case eitherDecode input of
|
||||
Left e -> liftIO (die (e <> ". Invalid input on " <> show h <> ", expecting JSON"))
|
||||
Right d -> pure d
|
||||
|
||||
toBlob :: Blob -> Blob.Blob
|
||||
toBlob Blob{..} = Blob.sourceBlob path language' (fromText content)
|
||||
|
@ -77,7 +77,15 @@ diffBlobPairs renderer = fmap toOutput . distributeFoldMap (diffBlobPair rendere
|
||||
diffBlobPair :: DiffRenderer output -> Both Blob -> Task output
|
||||
diffBlobPair renderer blobs = case (renderer, effectiveLanguage) of
|
||||
(OldToCDiffRenderer, lang)
|
||||
| lang `elem` [ Just Language.Go, Just Language.Markdown, Just Language.Python, Just Language.Ruby ]
|
||||
| elem lang $ fmap Just [
|
||||
Language.Go,
|
||||
Language.JSX,
|
||||
Language.JavaScript,
|
||||
Language.Markdown,
|
||||
Language.Python,
|
||||
Language.Ruby,
|
||||
Language.TypeScript
|
||||
]
|
||||
, Just (SomeParser parser) <- lang >>= someParser (Proxy :: Proxy '[Diffable, Eq1, Foldable, Functor, GAlign, HasDeclaration, Show1, Traversable]) ->
|
||||
run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob)) diffTerms (renderToCDiff blobs)
|
||||
| Just syntaxParser <- lang >>= syntaxParserForLanguage ->
|
||||
|
Loading…
Reference in New Issue
Block a user