@@ -20,7 +20,7 @@ import Development.IDE.Core.OfInterest (kick)
20
20
import Development.IDE.Core.Rules (mainRule )
21
21
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
22
22
import qualified Development.IDE.Plugin.Test as Test
23
- import Development.IDE.Session (setInitialDynFlags , getHieDbLoc , runWithDb )
23
+ import Development.IDE.Session (setInitialDynFlags , getHieDbLoc )
24
24
import Development.IDE.Types.Options
25
25
import qualified Development.IDE.Main as Main
26
26
import Development.Shake (ShakeOptions (shakeThreads ))
@@ -56,9 +56,6 @@ main = do
56
56
57
57
whenJust argsCwd IO. setCurrentDirectory
58
58
59
- dir <- IO. getCurrentDirectory
60
- dbLoc <- getHieDbLoc dir
61
-
62
59
-- lock to avoid overlapping output on stdout
63
60
lock <- newLock
64
61
let logger = Logger $ \ pri msg -> when (pri >= logLevel) $ withLock lock $
@@ -67,7 +64,9 @@ main = do
67
64
68
65
case argFilesOrCmd of
69
66
DbCmd opts cmd -> do
70
- mlibdir <- setInitialDynFlags
67
+ dir <- IO. getCurrentDirectory
68
+ dbLoc <- getHieDbLoc dir
69
+ mlibdir <- setInitialDynFlags def
71
70
case mlibdir of
72
71
Nothing -> exitWith $ ExitFailure 1
73
72
Just libdir -> runCommand libdir opts{database = dbLoc} cmd
@@ -80,40 +79,39 @@ main = do
80
79
hPutStrLn stderr " If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
81
80
_ -> return ()
82
81
83
- runWithDb dbLoc $ \ hiedb hiechan ->
84
- Main. defaultMain (Main. defArguments hiedb hiechan)
85
- {Main. argFiles = case argFilesOrCmd of
86
- Typecheck x | not argLSP -> Just x
87
- _ -> Nothing
88
-
89
- ,Main. argsLogger = logger
90
-
91
- ,Main. argsRules = do
92
- -- install the main and ghcide-plugin rules
93
- mainRule
94
- -- install the kick action, which triggers a typecheck on every
95
- -- Shake database restart, i.e. on every user edit.
96
- unless argsDisableKick $
97
- action kick
98
-
99
- ,Main. argsHlsPlugins =
100
- pluginDescToIdePlugins $
101
- GhcIde. descriptors
102
- ++ [Test. blockCommandDescriptor " block-command" | argsTesting]
103
-
104
- ,Main. argsGhcidePlugin = if argsTesting
105
- then Test. plugin
106
- else mempty
107
-
108
- ,Main. argsIdeOptions = \ (fromMaybe def -> config) sessionLoader ->
109
- let defOptions = defaultIdeOptions sessionLoader
110
- in defOptions
111
- { optShakeProfiling = argsShakeProfiling
112
- , optOTMemoryProfiling = IdeOTMemoryProfiling argsOTMemoryProfiling
113
- , optTesting = IdeTesting argsTesting
114
- , optShakeOptions = (optShakeOptions defOptions){shakeThreads = argsThreads}
115
- , optCheckParents = pure $ checkParents config
116
- , optCheckProject = pure $ checkProject config
117
- }
118
- }
82
+ Main. defaultMain def
83
+ {Main. argFiles = case argFilesOrCmd of
84
+ Typecheck x | not argLSP -> Just x
85
+ _ -> Nothing
86
+
87
+ ,Main. argsLogger = logger
88
+
89
+ ,Main. argsRules = do
90
+ -- install the main and ghcide-plugin rules
91
+ mainRule
92
+ -- install the kick action, which triggers a typecheck on every
93
+ -- Shake database restart, i.e. on every user edit.
94
+ unless argsDisableKick $
95
+ action kick
96
+
97
+ ,Main. argsHlsPlugins =
98
+ pluginDescToIdePlugins $
99
+ GhcIde. descriptors
100
+ ++ [Test. blockCommandDescriptor " block-command" | argsTesting]
101
+
102
+ ,Main. argsGhcidePlugin = if argsTesting
103
+ then Test. plugin
104
+ else mempty
105
+
106
+ ,Main. argsIdeOptions = \ (fromMaybe def -> config) sessionLoader ->
107
+ let defOptions = defaultIdeOptions sessionLoader
108
+ in defOptions
109
+ { optShakeProfiling = argsShakeProfiling
110
+ , optOTMemoryProfiling = IdeOTMemoryProfiling argsOTMemoryProfiling
111
+ , optTesting = IdeTesting argsTesting
112
+ , optShakeOptions = (optShakeOptions defOptions){shakeThreads = argsThreads}
113
+ , optCheckParents = pure $ checkParents config
114
+ , optCheckProject = pure $ checkProject config
115
+ }
116
+ }
119
117
0 commit comments