1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

s/File/Project b/c that makes more sense to me

This commit is contained in:
Timothy Clem 2018-05-16 08:38:00 -07:00
parent 5ca452df39
commit f81ea4bff5
9 changed files with 20 additions and 19 deletions

View File

@ -70,7 +70,6 @@ library
, Data.Blob
, Data.Diff
, Data.Error
, Data.File
, Data.Functor.Both
, Data.Functor.Classes.Generic
, Data.Graph
@ -79,6 +78,7 @@ library
, Data.Map.Monoidal
, Data.Mergeable
, Data.Patch
, Data.Project
, Data.Range
, Data.Record
, Data.Semigroup.App

View File

@ -1,16 +1,10 @@
module Data.File where
module Data.Project where
import Data.ByteString.Char8 as BC (pack)
import Data.Language
import Prologue
import System.FilePath.Posix
data File = File
{ filePath :: FilePath
, fileLanguage :: Maybe Language
}
deriving (Eq, Ord, Show)
data Project = Project
{ projectRootDir :: FilePath
, projectFiles :: [File]
@ -20,12 +14,19 @@ data Project = Project
}
deriving (Eq, Ord, Show)
file :: FilePath -> File
file path = File path (languageForFilePath path)
where languageForFilePath = languageForType . takeExtension
projectName :: Project -> ByteString
projectName = BC.pack . dropExtensions . takeFileName . projectRootDir
projectExtensions :: Project -> [String]
projectExtensions = extensionsForLanguage . projectLanguage
data File = File
{ filePath :: FilePath
, fileLanguage :: Maybe Language
}
deriving (Eq, Ord, Show)
file :: FilePath -> File
file path = File path (languageForFilePath path)
where languageForFilePath = languageForType . takeExtension

View File

@ -29,7 +29,7 @@ import Data.Record
import Data.Sum
import qualified Data.Syntax as Syntax
import Data.Term
import Data.File
import Data.Project
import Foreign.Ptr
import qualified GHC.TypeLits as TypeLevel
import qualified Language.Go.Assignment as Go

View File

@ -6,7 +6,7 @@ module Semantic.CLI
, Parse.runParse
) where
import Data.File
import Data.Project
import Data.Language (Language)
import Data.List (intercalate)
import Data.List.Split (splitWhen)

View File

@ -27,7 +27,7 @@ import Data.Abstract.Module
import Data.Abstract.Package as Package
import Data.Abstract.Value (Value, ValueError(..), runValueErrorWith)
import Data.ByteString.Char8 (pack)
import Data.File
import Data.Project
import Data.Record
import Data.Semilattice.Lower
import Data.Term

View File

@ -38,7 +38,7 @@ import Control.Monad.IO.Class
import Data.Aeson
import qualified Data.Blob as Blob
import Data.Bool
import Data.File
import Data.Project
import qualified Data.ByteString as B
import qualified Data.ByteString.Builder as B
import qualified Data.ByteString.Lazy as BL

View File

@ -5,7 +5,7 @@ import Control.Monad.Effect
import Data.Aeson
import Data.Aeson.Types (parseMaybe)
import Data.Blob
import Data.File
import Data.Project
import qualified Data.Map as Map
import Data.Source
import Data.Language

View File

@ -12,7 +12,7 @@ import Data.Abstract.Evaluatable
import Data.Abstract.Value
import Data.Abstract.Type
import Data.Blob
import Data.File
import Data.Project
import qualified Data.Language as Language
import qualified GHC.TypeLits as TypeLevel
import Language.Preluded

View File

@ -29,7 +29,7 @@ import Data.Bifunctor (first)
import Data.Blob as X
import Data.ByteString.Builder (toLazyByteString)
import Data.ByteString.Lazy (toStrict)
import Data.File as X
import Data.Project as X
import Data.Functor.Listable as X
import Data.Language as X
import Data.List.NonEmpty as X (NonEmpty(..))