Skip to content

Commit 16e58b8

Browse files
committed
Use more System.FilePath functions
1 parent de212d1 commit 16e58b8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

ghcide/src/Development/IDE/Core/Actions.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import Language.LSP.Protocol.Types (DocumentHighlight (..),
4040
SymbolInformation (..))
4141
import Language.LSP.Server (resRootPath)
4242
import System.Directory (createDirectoryIfMissing, doesFileExist)
43-
import System.FilePath ((</>), takeDirectory)
43+
import System.FilePath ((</>), (<.>), takeDirectory)
4444

4545

4646
-- | Generates URIs for files in dependencies, but not in the
@@ -80,7 +80,7 @@ lookupMod HieDbWriter{indexQueue} hieFile moduleName uid _boot = MaybeT $ do
8080
writeOutDir :: FilePath
8181
writeOutDir = projectRoot </> ".hls" </> "dependencies" </> show uid
8282
writeOutFile :: FilePath
83-
writeOutFile = moduleNameSlashes moduleName ++ ".hs"
83+
writeOutFile = moduleNameSlashes moduleName <.> "hs"
8484
writeOutPath :: FilePath
8585
writeOutPath = writeOutDir </> writeOutFile
8686
moduleUri :: Uri

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,12 @@ data SourceFileOrigin = FromProject | FromDependency
11321132

11331133
getSourceFileOrigin :: NormalizedFilePath -> SourceFileOrigin
11341134
getSourceFileOrigin f =
1135-
case isInfixOf ".hls/dependencies" (show f) of
1135+
case [".hls", "dependencies"] `isInfixOf` (splitDirectories file) of
11361136
True -> FromDependency
11371137
False -> FromProject
1138+
where
1139+
file :: FilePath
1140+
file = fromNormalizedFilePath f
11381141

11391142
defineEarlyCutoff'
11401143
:: forall k v. IdeRule k v

ghcide/src/Development/IDE/Types/HscEnvEq.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ newHscEnvEqWithImportPaths envImportPaths recorder se hscEnv deps = do
151151
indexModuleHieFile hieDir m = do
152152
let hiePath :: NormalizedFilePath
153153
hiePath = toNormalizedFilePath' $
154-
hieDir </> moduleNameSlashes (moduleName m) ++ ".hie"
154+
hieDir </> moduleNameSlashes (moduleName m) <.> "hie"
155155
hieCheck <- checkHieFile recorder se "newHscEnvEqWithImportPaths" hiePath
156156
case hieCheck of
157157
HieFileMissing -> return ()

0 commit comments

Comments
 (0)