Skip to content

Commit f222826

Browse files
committed
Use moduleNameSlashes
1 parent 2fab83a commit f222826

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,11 @@ lookupMod HieDbWriter{indexQueue} hieFile moduleName uid _boot = MaybeT $ do
8080
writeOutDir :: FilePath
8181
writeOutDir = projectRoot </> ".hls" </> "dependencies" </> show uid
8282
writeOutFile :: FilePath
83-
writeOutFile = toFilePath moduleName ++ ".hs"
83+
writeOutFile = moduleNameSlashes moduleName ++ ".hs"
8484
writeOutPath :: FilePath
8585
writeOutPath = writeOutDir </> writeOutFile
8686
moduleUri :: Uri
8787
moduleUri = AtPoint.toUri writeOutPath
88-
toFilePath :: ModuleName -> FilePath
89-
toFilePath = separateDirectories . prettyModuleName
90-
where
91-
separateDirectories :: FilePath -> FilePath
92-
separateDirectories moduleNameString =
93-
case breakOnDot moduleNameString of
94-
[] -> ""
95-
ms -> foldr1 (</>) ms
96-
breakOnDot :: FilePath -> [FilePath]
97-
breakOnDot = words . map replaceDotWithSpace
98-
replaceDotWithSpace :: Char -> Char
99-
replaceDotWithSpace '.' = ' '
100-
replaceDotWithSpace c = c
101-
prettyModuleName :: ModuleName -> String
102-
prettyModuleName = filter (/= '"')
103-
. concat
104-
. drop 1
105-
. words
106-
. show
10788

10889

10990

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,33 +151,14 @@ newHscEnvEqWithImportPaths envImportPaths recorder se hscEnv deps = do
151151
indexModuleHieFile hieDir modIface = do
152152
let hiePath :: NormalizedFilePath
153153
hiePath = toNormalizedFilePath' $
154-
hieDir </> toFilePath (moduleName $ mi_module modIface) ++ ".hie"
154+
hieDir </> moduleNameSlashes (moduleName $ mi_module modIface) ++ ".hie"
155155
hieCheck <- checkHieFile recorder se "newHscEnvEqWithImportPaths" hiePath
156156
case hieCheck of
157157
HieFileMissing -> return ()
158158
HieAlreadyIndexed -> return ()
159159
CouldNotLoadHie _e -> return ()
160160
DoIndexing hash hie ->
161161
indexHieFile se hiePath (FakeFile Nothing) hash hie
162-
toFilePath :: ModuleName -> FilePath
163-
toFilePath = separateDirectories . prettyModuleName
164-
where
165-
separateDirectories :: FilePath -> FilePath
166-
separateDirectories moduleNameString =
167-
case breakOnDot moduleNameString of
168-
[] -> ""
169-
ms -> foldr1 (</>) ms
170-
breakOnDot :: FilePath -> [FilePath]
171-
breakOnDot = words . map replaceDotWithSpace
172-
replaceDotWithSpace :: Char -> Char
173-
replaceDotWithSpace '.' = ' '
174-
replaceDotWithSpace c = c
175-
prettyModuleName :: ModuleName -> String
176-
prettyModuleName = filter (/= '"')
177-
. concat
178-
. drop 1
179-
. words
180-
. show
181162
loadModIface :: Module -> IO (Maybe ModIface)
182163
loadModIface m = do
183164
modIface <- initIfaceLoad hscEnv $

0 commit comments

Comments
 (0)