on 210de4e help sign in
47 lines 1.6 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
3{-# LANGUAGE PatternSynonyms #-}
4module Development.IDE.Types.LSP
5 ( HoverText(..)
6 , VirtualResource(..)
7 , getHoverTextContent
8 , pattern EventFileDiagnostics
9 ) where
11import Control.DeepSeq
12import qualified Data.Text as T
13import Development.IDE.Types.Diagnostics
14import GHC.Generics
15import Language.Haskell.LSP.Messages
16import Language.Haskell.LSP.Types
18-- | Different types of content we can show on hover.
19data HoverText
20 = HoverDamlCode !T.Text
21 -- ^ Highlighted DAML-Code
22 | HoverMarkdown !T.Text
23 -- ^ Markdown text.
24 deriving Show
26getHoverTextContent :: HoverText -> T.Text
27getHoverTextContent = \case
28 HoverDamlCode t -> t
29 HoverMarkdown t -> t
31-- | Virtual resources
32data VirtualResource = VRScenario
33 { vrScenarioFile :: !NormalizedFilePath
34 , vrScenarioName :: !T.Text
35 } deriving (Eq, Ord, Show, Generic)
36 -- ^ VRScenario identifies a scenario in a given file.
37 -- This virtual resource is associated with the HTML result of
38 -- interpreting the corresponding scenario.
40instance NFData VirtualResource
42-- | Pattern synonym to make it a bit more convenient to match on diagnostics
43-- in things like damlc test.
44pattern EventFileDiagnostics :: FilePath -> [Diagnostic] -> FromServerMessage
45pattern EventFileDiagnostics fp diags <-
46 NotPublishDiagnostics
47 (NotificationMessage _ _ (PublishDiagnosticsParams (uriToFilePath' -> Just fp) (List diags)))