Skip to content

Commit 97d8965

Browse files
authored
Fix ghcide and HLS enter lsp mode by default (haskell#1692)
1 parent 607ae3b commit 97d8965

File tree

5 files changed

+3
-11
lines changed

5 files changed

+3
-11
lines changed

ghcide/exe/Arguments.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ arguments = Arguments
4242
<*> (commandP <|> lspCommand <|> checkCommand)
4343
where
4444
checkCommand = Check <$> many (argument str (metavar "FILES/DIRS..."))
45-
lspCommand = LSP <$ switch (long "lsp" <> help "Start talking to an LSP client")
45+
lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP client")

ghcide/exe/Main.hs

-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import Development.IDE (Logger (Logger),
2222
Priority (Info), action)
2323
import Development.IDE.Core.OfInterest (kick)
2424
import Development.IDE.Core.Rules (mainRule)
25-
import Development.IDE.Main (Command (LSP))
2625
import qualified Development.IDE.Main as Main
2726
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
2827
import qualified Development.IDE.Plugin.Test as Test
@@ -77,12 +76,6 @@ main = do
7776
T.putStrLn $ T.pack ("[" ++ upper (show pri) ++ "] ") <> msg
7877
logLevel = if argsVerbose then minBound else Info
7978

80-
case argsCommand of
81-
LSP -> do
82-
hPutStrLn stderr "Starting LSP server..."
83-
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
84-
_ -> return ()
85-
8679
Main.defaultMain def
8780
{Main.argCommand = argsCommand
8881

ghcide/src/Development/IDE/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ defaultMain Arguments{..} = do
199199
LSP -> do
200200
t <- offsetTime
201201
hPutStrLn stderr "Starting LSP server..."
202-
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
202+
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!"
203203
runLanguageServer options inH outH argsGetHieDbLoc argsDefaultHlsConfig argsOnConfigChange (pluginHandlers plugins) $ \env vfs rootPath hiedb hieChan -> do
204204
t <- t
205205
hPutStrLn stderr $ "Started LSP server in " ++ showDuration t

src/Ide/Arguments.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ arguments = GhcideArguments
120120
<*> switch (long "project-ghc-version"
121121
<> help "Work out the project GHC version and print it")
122122
where
123-
lspCommand = LSP <$ switch (long "lsp" <> help "Start talking to an LSP server")
123+
lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP server")
124124
checkCommand = Check <$> many (argument str (metavar "FILES/DIRS..."))
125125

126126
-- ---------------------------------------------------------------------

src/Ide/Main.hs

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ runLspMode ghcideArgs@GhcideArguments{..} idePlugins = do
8686
hPutStrLn stderr $ " with arguments: " <> show ghcideArgs
8787
hPutStrLn stderr $ " with plugins: " <> show (map fst $ ipMap idePlugins)
8888
hPutStrLn stderr $ " in directory: " <> dir
89-
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
9089

9190
Main.defaultMain def
9291
{ Main.argCommand = argsCommand

0 commit comments

Comments
 (0)