-
Notifications
You must be signed in to change notification settings - Fork 2
/
VSCodeSettings.hs
29 lines (24 loc) · 1.06 KB
/
VSCodeSettings.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- | Copyright : (c) Crown Copyright GCHQ
module Bootstrap.Data.Bootstrappable.VSCodeSettings (VSCodeSettings, vsCodeSettingsFor) where
import Bootstrap.Data.Bootstrappable
( Bootstrappable (bootstrapContent, bootstrapName, bootstrapReason),
bootstrapContentPrettyJson,
)
import Bootstrap.Data.DevContainer
( DevContainerConfig (DevContainerConfig),
)
import Data.Aeson (KeyValue ((.=)), ToJSON (toJSON))
import qualified Data.Aeson as Aeson
data VSCodeSettings = VSCodeSettings
instance Bootstrappable VSCodeSettings where
bootstrapName = const ".vscode/settings.json"
bootstrapReason = const "This configures the settings for the extensions we recommend for VSCode."
bootstrapContent = bootstrapContentPrettyJson []
instance ToJSON VSCodeSettings where
toJSON =
const $
Aeson.object
["nixEnvSelector.nixFile" .= Aeson.String "${workspaceRoot}/shell.nix"]
vsCodeSettingsFor :: DevContainerConfig -> Maybe VSCodeSettings
vsCodeSettingsFor (DevContainerConfig True) = Just VSCodeSettings
vsCodeSettingsFor (DevContainerConfig False) = Nothing