mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Define a constructor for the default language modes.
This commit is contained in:
parent
9f82d6ad0e
commit
1ec65b4858
@ -11,6 +11,7 @@ module Data.Language
|
||||
, textToLanguage
|
||||
, languageToText
|
||||
, PerLanguageModes(..)
|
||||
, defaultLanguageModes
|
||||
, LanguageMode(..)
|
||||
, modeForLanguage
|
||||
) where
|
||||
@ -147,6 +148,11 @@ newtype PerLanguageModes = PerLanguageModes
|
||||
}
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
defaultLanguageModes :: PerLanguageModes
|
||||
defaultLanguageModes = PerLanguageModes
|
||||
{ pythonMode = ALaCarte
|
||||
}
|
||||
|
||||
data LanguageMode
|
||||
= ALaCarte
|
||||
| Precise
|
||||
|
@ -18,7 +18,7 @@ import qualified Data.ByteString.Char8 as BC
|
||||
import qualified Data.ByteString.Lazy.Char8 as BLC
|
||||
import qualified Data.ByteString.Streaming.Char8 as ByteStream
|
||||
import Data.Either
|
||||
import Data.Language (LanguageMode(..), PerLanguageModes(..))
|
||||
import Data.Language (defaultLanguageModes)
|
||||
import Data.Set (Set)
|
||||
import Data.Traversable
|
||||
import Data.Typeable
|
||||
@ -123,4 +123,4 @@ knownFailuresForPath tsDir (Just path)
|
||||
|
||||
|
||||
parseFilePath :: (Member (Error SomeException) sig, Member Distribute sig, Member Task sig, Member Files sig, Carrier sig m, MonadIO m) => Path.RelFile -> m Bool
|
||||
parseFilePath path = readBlob (fileForRelPath path) >>= runReader (PerLanguageModes ALaCarte) . parseTermBuilder @[] TermShow . pure >>= const (pure True)
|
||||
parseFilePath path = readBlob (fileForRelPath path) >>= runReader defaultLanguageModes . parseTermBuilder @[] TermShow . pure >>= const (pure True)
|
||||
|
@ -95,7 +95,7 @@ diffFilePaths session paths
|
||||
parseFilePath :: TaskSession -> Path.RelFile -> IO (Either SomeException ByteString)
|
||||
parseFilePath session path = do
|
||||
blob <- readBlobFromFile (fileForRelPath path)
|
||||
res <- runTask session . runReader (PerLanguageModes ALaCarte) $ parseTermBuilder TermSExpression (toList blob)
|
||||
res <- runTask session . runReader defaultLanguageModes $ parseTermBuilder TermSExpression (toList blob)
|
||||
pure (runBuilder <$> res)
|
||||
|
||||
-- | Read two files to a BlobPair.
|
||||
|
Loading…
Reference in New Issue
Block a user