Support --ghc-option in damlc ide (#2619)

fixes #2612
This commit is contained in:
Moritz Kiefer 2019-08-21 15:56:15 +02:00 committed by mergify[bot]
parent 3f0aaf08f3
commit 82ad89e770
2 changed files with 21 additions and 9 deletions

View File

@ -94,7 +94,12 @@ cmdIde =
"Start the DAML language server on standard input/output."
<> fullDesc
where
cmd = execIde <$> telemetryOpt <*> debugOpt <*> enableScenarioOpt <*> shakeProfilingOpt
cmd = execIde
<$> telemetryOpt
<*> debugOpt
<*> enableScenarioOpt
<*> optGhcCustomOptions
<*> shakeProfilingOpt
cmdLicense :: Mod CommandFields Command
cmdLicense =
@ -278,9 +283,10 @@ execLicense = B.putStr licenseData
execIde :: Telemetry
-> Debug
-> EnableScenarioService
-> [String]
-> Maybe FilePath
-> Command
execIde telemetry (Debug debug) enableScenarioService mbProfileDir = NS.withSocketsDo $ do
execIde telemetry (Debug debug) enableScenarioService ghcOpts mbProfileDir = NS.withSocketsDo $ do
let threshold =
if debug
then Logger.Debug
@ -312,6 +318,7 @@ execIde telemetry (Debug debug) enableScenarioService mbProfileDir = NS.withSock
, optShakeProfiling = mbProfileDir
, optThreads = 0
, optDlintUsage = DlintEnabled dlintDataDir True
, optGhcCustomOpts = ghcOpts
}
scenarioServiceConfig <- readScenarioServiceConfig
withLogger $ \loggerH ->
@ -865,7 +872,7 @@ optionsParser numProcessors enableScenarioService parsePkgName = Options
<*> optShakeThreads
<*> lfVersionOpt
<*> optDebugLog
<*> (concat <$> many optGhcCustomOptions)
<*> optGhcCustomOptions
<*> pure enableScenarioService
<*> pure (optScenarioValidation $ defaultOptions Nothing)
<*> dlintUsageOpt
@ -929,12 +936,14 @@ optionsParser numProcessors enableScenarioService parsePkgName = Options
, "Note that the output is not deterministic for > 1 job."
]
optGhcCustomOptions :: Parser [String]
optGhcCustomOptions =
option (stringsSepBy ' ') $
long "ghc-option" <>
metavar "OPTION" <>
help "Options to pass to the underlying GHC"
optGhcCustomOptions :: Parser [String]
optGhcCustomOptions =
fmap concat $ many $
option (stringsSepBy ' ') $
long "ghc-option" <>
metavar "OPTION" <>
help "Options to pass to the underlying GHC"
shakeProfilingOpt :: Parser (Maybe FilePath)
shakeProfilingOpt = optional $ strOption $

View File

@ -19,3 +19,6 @@ HEAD — ongoing
+ [DAML-LF] **Breaking** Rename ``NUMERIC`` back to ``DECIMAL`` in Protobuf definition.
+ [DAML Compiler] Allow more contexts in generic templates. Specifically, template constraints can
have arguments besides type variables, if the FlexibleContexts extension is enabled.
+ [DAML Studio] ``damlc ide`` now also accepts ``--ghc-option`` arguments like ``damlc build``
so ``damlc ide --ghc-option -W`` launches the IDE with more warnings. Note that
an option for the VSCode extension to pass additional options is still work in progress.