File tree 3 files changed +13
-3
lines changed
ghcide/src/Development/IDE/Core
3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import qualified Development.IDE.Spans.AtPoint as AtPoint
37
37
import Development.IDE.Types.HscEnvEq (hscEnv )
38
38
import Development.IDE.Types.Location
39
39
import qualified HieDb
40
+ import Ide.Types (hlsDirectory , dependenciesDirectory )
40
41
import Language.LSP.Protocol.Types (DocumentHighlight (.. ),
41
42
SymbolInformation (.. ),
42
43
normalizedFilePathToUri ,
@@ -116,7 +117,7 @@ lookupMod HieDbWriter{indexQueue} hieFile moduleName uid _boot = MaybeT $ do
116
117
-- name and hash of the package the dependency module is
117
118
-- found in. The name and hash are both parts of the UnitId.
118
119
writeOutDir :: FilePath
119
- writeOutDir = projectRoot </> " .hls " </> " dependencies " </> show uid
120
+ writeOutDir = projectRoot </> hlsDirectory </> dependenciesDirectory </> show uid
120
121
-- The module name is separated into directories, with the
121
122
-- last part of the module name giving the name of the
122
123
-- haskell file with a .hs extension.
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import HieDb (SourceFile (FakeFile),
22
22
lookupPackage ,
23
23
removeDependencySrcFiles )
24
24
import Ide.Logger (Recorder , WithPriority )
25
+ import Ide.Types (hlsDirectory )
25
26
import Language.LSP.Server (resRootPath )
26
27
import System.Directory (doesDirectoryExist )
27
28
import System.FilePath ((<.>) , (</>) )
@@ -46,7 +47,7 @@ indexDependencyHieFiles recorder se hscEnv = do
46
47
mHlsDir :: Maybe FilePath
47
48
mHlsDir = do
48
49
projectDir <- resRootPath =<< lspEnv se
49
- pure $ projectDir </> " .hls "
50
+ pure $ projectDir </> hlsDirectory
50
51
-- Add the deletion of dependency source files from the
51
52
-- HieDb database to the database write queue.
52
53
deleteMissingDependencySources :: IO ()
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ module Ide.Types
47
47
, PluginNotificationHandlers (.. )
48
48
, PluginRequestMethod (.. )
49
49
, SourceFileOrigin (.. )
50
+ , dependenciesDirectory
51
+ , hlsDirectory
50
52
, getSourceFileOrigin
51
53
, getProcessID, getPid
52
54
, installSigUsr1Handler
@@ -296,13 +298,19 @@ data PluginFileType = PluginFileType [SourceFileOrigin] [T.Text]
296
298
297
299
data SourceFileOrigin = FromProject | FromDependency deriving Eq
298
300
301
+ hlsDirectory :: FilePath
302
+ hlsDirectory = " .hls"
303
+
304
+ dependenciesDirectory :: FilePath
305
+ dependenciesDirectory = " dependencies"
306
+
299
307
-- | Dependency files are written to the .hls/dependencies directory
300
308
-- under the project root.
301
309
-- If a file is not in this directory, we assume that it is a
302
310
-- project file.
303
311
getSourceFileOrigin :: NormalizedFilePath -> SourceFileOrigin
304
312
getSourceFileOrigin f =
305
- case [" .hls " , " dependencies " ] `isInfixOf` (splitDirectories file) of
313
+ case [hlsDirectory, dependenciesDirectory ] `isInfixOf` (splitDirectories file) of
306
314
True -> FromDependency
307
315
False -> FromProject
308
316
where
You can’t perform that action at this time.
0 commit comments