Skip to content

Commit

Permalink
Fix ghcide and HLS enter lsp mode by default (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
berberman committed Apr 8, 2021
1 parent 607ae3b commit 97d8965
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ghcide/exe/Arguments.hs
Expand Up @@ -42,4 +42,4 @@ arguments = Arguments
<*> (commandP <|> lspCommand <|> checkCommand)
where
checkCommand = Check <$> many (argument str (metavar "FILES/DIRS..."))
lspCommand = LSP <$ switch (long "lsp" <> help "Start talking to an LSP client")
lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP client")
7 changes: 0 additions & 7 deletions ghcide/exe/Main.hs
Expand Up @@ -22,7 +22,6 @@ import Development.IDE (Logger (Logger),
Priority (Info), action)
import Development.IDE.Core.OfInterest (kick)
import Development.IDE.Core.Rules (mainRule)
import Development.IDE.Main (Command (LSP))
import qualified Development.IDE.Main as Main
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
import qualified Development.IDE.Plugin.Test as Test
Expand Down Expand Up @@ -77,12 +76,6 @@ main = do
T.putStrLn $ T.pack ("[" ++ upper (show pri) ++ "] ") <> msg
logLevel = if argsVerbose then minBound else Info

case argsCommand of
LSP -> do
hPutStrLn stderr "Starting LSP server..."
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
_ -> return ()

Main.defaultMain def
{Main.argCommand = argsCommand

Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Main.hs
Expand Up @@ -199,7 +199,7 @@ defaultMain Arguments{..} = do
LSP -> do
t <- offsetTime
hPutStrLn stderr "Starting LSP server..."
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!"
runLanguageServer options inH outH argsGetHieDbLoc argsDefaultHlsConfig argsOnConfigChange (pluginHandlers plugins) $ \env vfs rootPath hiedb hieChan -> do
t <- t
hPutStrLn stderr $ "Started LSP server in " ++ showDuration t
Expand Down
2 changes: 1 addition & 1 deletion src/Ide/Arguments.hs
Expand Up @@ -120,7 +120,7 @@ arguments = GhcideArguments
<*> switch (long "project-ghc-version"
<> help "Work out the project GHC version and print it")
where
lspCommand = LSP <$ switch (long "lsp" <> help "Start talking to an LSP server")
lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP server")
checkCommand = Check <$> many (argument str (metavar "FILES/DIRS..."))

-- ---------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/Ide/Main.hs
Expand Up @@ -86,7 +86,6 @@ runLspMode ghcideArgs@GhcideArguments{..} idePlugins = do
hPutStrLn stderr $ " with arguments: " <> show ghcideArgs
hPutStrLn stderr $ " with plugins: " <> show (map fst $ ipMap idePlugins)
hPutStrLn stderr $ " in directory: " <> dir
hPutStrLn stderr "If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!"

Main.defaultMain def
{ Main.argCommand = argsCommand
Expand Down

0 comments on commit 97d8965

Please sign in to comment.