Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ghcide and HLS enter lsp mode by default #1692

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghcide/exe/Arguments.hs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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