Skip to content

Commit

Permalink
Use more System.FilePath functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nlander committed Jul 15, 2023
1 parent de212d1 commit 16e58b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import Language.LSP.Protocol.Types (DocumentHighlight (..),
SymbolInformation (..))
import Language.LSP.Server (resRootPath)
import System.Directory (createDirectoryIfMissing, doesFileExist)
import System.FilePath ((</>), takeDirectory)
import System.FilePath ((</>), (<.>), takeDirectory)


-- | Generates URIs for files in dependencies, but not in the
Expand Down Expand Up @@ -80,7 +80,7 @@ lookupMod HieDbWriter{indexQueue} hieFile moduleName uid _boot = MaybeT $ do
writeOutDir :: FilePath
writeOutDir = projectRoot </> ".hls" </> "dependencies" </> show uid
writeOutFile :: FilePath
writeOutFile = moduleNameSlashes moduleName ++ ".hs"
writeOutFile = moduleNameSlashes moduleName <.> "hs"
writeOutPath :: FilePath
writeOutPath = writeOutDir </> writeOutFile
moduleUri :: Uri
Expand Down
5 changes: 4 additions & 1 deletion ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,9 +1132,12 @@ data SourceFileOrigin = FromProject | FromDependency

getSourceFileOrigin :: NormalizedFilePath -> SourceFileOrigin
getSourceFileOrigin f =
case isInfixOf ".hls/dependencies" (show f) of
case [".hls", "dependencies"] `isInfixOf` (splitDirectories file) of
True -> FromDependency
False -> FromProject
where
file :: FilePath
file = fromNormalizedFilePath f

defineEarlyCutoff'
:: forall k v. IdeRule k v
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Types/HscEnvEq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ newHscEnvEqWithImportPaths envImportPaths recorder se hscEnv deps = do
indexModuleHieFile hieDir m = do
let hiePath :: NormalizedFilePath
hiePath = toNormalizedFilePath' $
hieDir </> moduleNameSlashes (moduleName m) ++ ".hie"
hieDir </> moduleNameSlashes (moduleName m) <.> "hie"
hieCheck <- checkHieFile recorder se "newHscEnvEqWithImportPaths" hiePath
case hieCheck of
HieFileMissing -> return ()
Expand Down

0 comments on commit 16e58b8

Please sign in to comment.