Skip to content

Commit 3c686d9

Browse files
committed
Use moduleNameSlashes
1 parent 59b518b commit 3c686d9

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
@@ -155,33 +155,14 @@ newHscEnvEqWithImportPaths envImportPaths recorder se hscEnv deps = do
155155
indexModuleHieFile hieDir modIface = do
156156
let hiePath :: NormalizedFilePath
157157
hiePath = toNormalizedFilePath' $
158-
hieDir </> toFilePath (moduleName $ mi_module modIface) ++ ".hie"
158+
hieDir </> moduleNameSlashes (moduleName $ mi_module modIface) ++ ".hie"
159159
hieCheck <- checkHieFile recorder se "newHscEnvEqWithImportPaths" hiePath
160160
case hieCheck of
161161
HieFileMissing -> return ()
162162
HieAlreadyIndexed -> return ()
163163
CouldNotLoadHie _e -> return ()
164164
DoIndexing hash hie ->
165165
indexHieFile se hiePath (FakeFile Nothing) hash hie
166-
toFilePath :: ModuleName -> FilePath
167-
toFilePath = separateDirectories . prettyModuleName
168-
where
169-
separateDirectories :: FilePath -> FilePath
170-
separateDirectories moduleNameString =
171-
case breakOnDot moduleNameString of
172-
[] -> ""
173-
ms -> foldr1 (</>) ms
174-
breakOnDot :: FilePath -> [FilePath]
175-
breakOnDot = words . map replaceDotWithSpace
176-
replaceDotWithSpace :: Char -> Char
177-
replaceDotWithSpace '.' = ' '
178-
replaceDotWithSpace c = c
179-
prettyModuleName :: ModuleName -> String
180-
prettyModuleName = filter (/= '"')
181-
. concat
182-
. drop 1
183-
. words
184-
. show
185166
loadModIface :: Module -> IO (Maybe ModIface)
186167
loadModIface m = do
187168
modIface <- initIfaceLoad hscEnv $

0 commit comments

Comments
 (0)