on bec100b help sign in
61 lines 2.1 kB history raw
1-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2-- SPDX-License-Identifier: Apache-2.0
4module Development.IDE.Types.LSP
5 ( HoverText(..)
6 , Event(..)
7 , VirtualResource(..)
8 , getHoverTextContent
9 ) where
11import Control.DeepSeq
12import qualified Data.Text as T
13import GHC.Generics
15import Development.IDE.Types.Diagnostics
17-- | Different types of content we can show on hover.
18data HoverText
19 = HoverHeading !T.Text
20 -- ^ A header that explains the content below it.
21 | HoverDamlCode !T.Text
22 -- ^ Highlighted DAML-Code
23 | HoverMarkdown !T.Text
24 -- ^ Markdown text.
25 deriving Show
27getHoverTextContent :: HoverText -> T.Text
28getHoverTextContent = \case
29 HoverHeading t -> t
30 HoverDamlCode t -> t
31 HoverMarkdown t -> t
33-- | Virtual resources
34data VirtualResource = VRScenario
35 { vrScenarioFile :: !FilePath
36 , vrScenarioName :: !T.Text
37 } deriving (Eq, Ord, Read, Show, Generic)
38 -- ^ VRScenario identifies a scenario in a given file.
39 -- This virtual resource is associated with the HTML result of
40 -- interpreting the corresponding scenario.
42instance NFData VirtualResource
44-- | Compiler service events
45data Event
46 = EventFileDiagnostics !FileDiagnostics
47 -- ^ @EventFileDiagnostics fileDiagnostics@
48 -- How many validations have we finished of how many total
49 -- together with new file diagnostics for a given file.
50 | EventVirtualResourceChanged !VirtualResource T.Text
51 -- ^ @EventVirtualResourceChanged resource contents@ a virtual
52 -- resource @resource@ changed to @contents
53 -- NOTE(JM,MH): Keep the contents lazy as we rely on it in
54 -- 'manageOpenVRs'.
55 | EventFileValidation Int Int
56 -- ^ @EventFileValidation finishedValidations totalValidations @
57 -- How many validations have we finished of how many total.
58 | EventFatalError !T.Text
59 -- ^ @EventFatalError reason@: A fatal error occurred in the compiler and
60 -- the compiler cannot continue.
61 deriving Show