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

Narrow in on language support for now

This commit is contained in:
Timothy Clem 2019-04-12 15:48:35 -07:00
parent a37a737562
commit abd0bf08af
2 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,7 @@ readBlobsFromGitRepo path oid = liftIO . fmap catMaybes $
blobFromTreeEntry :: FilePath -> Git.TreeEntry -> IO (Maybe Blob) blobFromTreeEntry :: FilePath -> Git.TreeEntry -> IO (Maybe Blob)
blobFromTreeEntry gitDir (Git.TreeEntry Git.NormalMode Git.BlobObject oid path) blobFromTreeEntry gitDir (Git.TreeEntry Git.NormalMode Git.BlobObject oid path)
| lang <- languageForFilePath path | lang <- languageForFilePath path
, lang /= Unknown , lang `elem` codeNavLanguages
= Just . sourceBlob' path lang oid . fromText <$> Git.catFile gitDir oid = Just . sourceBlob' path lang oid . fromText <$> Git.catFile gitDir oid
blobFromTreeEntry _ _ = pure Nothing blobFromTreeEntry _ _ = pure Nothing

View File

@ -8,6 +8,7 @@ module Data.Language
, languageForFilePath , languageForFilePath
, languageForType , languageForType
, supportedExts , supportedExts
, codeNavLanguages
) where ) where
import Data.Aeson import Data.Aeson
@ -151,3 +152,6 @@ languageForFilePath = languageForType . takeExtension
supportedExts :: [String] supportedExts :: [String]
supportedExts = [".go", ".py", ".rb", ".js", ".ts"] supportedExts = [".go", ".py", ".rb", ".js", ".ts"]
codeNavLanguages :: [Language]
codeNavLanguages = [Go, Ruby, Python, JavaScript, TypeScript]