File tree Expand file tree Collapse file tree 6 files changed +39
-0
lines changed
src/Language/LSP/Protocol Expand file tree Collapse file tree 6 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ library
71
71
, base >= 4.11 && < 5
72
72
, binary
73
73
, containers
74
+ , data-default
74
75
, deepseq
75
76
, Diff >= 0.2
76
77
, dlist
@@ -122,6 +123,7 @@ library
122
123
Language.LSP.Protocol.Types.Location
123
124
Language.LSP.Protocol.Types.LspEnum
124
125
Language.LSP.Protocol.Types.MarkupContent
126
+ Language.LSP.Protocol.Types.Orphans
125
127
Language.LSP.Protocol.Types.Progress
126
128
Language.LSP.Protocol.Types.SemanticTokens
127
129
Language.LSP.Protocol.Types.Singletons
Original file line number Diff line number Diff line change 1
1
{-#LANGUAGE TemplateHaskell #-}
2
+ {-# OPTIONS_GHC -Wno-orphans #-}
2
3
3
4
module Language.LSP.Protocol.Message.Lens where
4
5
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ module Language.LSP.Protocol.Types (
24
24
, module WatchKinds
25
25
-- * Main LSP types and functions
26
26
, module Generated
27
+ -- ** Orphan instances for the generated types
28
+ , module Orphans
27
29
) where
28
30
29
31
import Language.LSP.Protocol.Internal.Types as Generated
@@ -37,4 +39,5 @@ import Language.LSP.Protocol.Types.Singletons as Singletons
37
39
import Language.LSP.Protocol.Types.Uri as Uri
38
40
import Language.LSP.Protocol.Types.Uri.OsPath as Uri
39
41
import Language.LSP.Protocol.Types.Edit as Edits
42
+ import Language.LSP.Protocol.Types.Orphans as Orphans
40
43
import Language.LSP.Protocol.Types.WatchKinds as WatchKinds
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ module Language.LSP.Protocol.Types.Common (
19
19
, Null (.. )
20
20
, absorbNull
21
21
, nullToMaybe
22
+ , maybeToNull
22
23
, (.=?)
23
24
) where
24
25
@@ -153,6 +154,17 @@ nullToMaybe :: a |? Null -> Maybe a
153
154
nullToMaybe (InL a) = Just a
154
155
nullToMaybe (InR _) = Nothing
155
156
157
+ maybeToNull :: Maybe a -> a |? Null
158
+ maybeToNull (Just x) = InL x
159
+ maybeToNull Nothing = InR Null
160
+
161
+ -- This is equivalent to the instance for 'Maybe s'
162
+ instance Semigroup s => Semigroup (s |? Null ) where
163
+ InL x <> InL y = InL (x <> y)
164
+ InL x <> InR _ = InL x
165
+ InR _ <> InL x = InL x
166
+ InR _ <> InR y = InR y
167
+
156
168
-- We use String so we can use fromString on it to get a key that works
157
169
-- in both aeson-1 and aeson-2
158
170
-- | Include a value in an JSON object optionally, omitting it if it is 'Nothing'.
Original file line number Diff line number Diff line change 1
1
{-#LANGUAGE TemplateHaskell #-}
2
+ {-# OPTIONS_GHC -Wno-orphans #-}
2
3
3
4
module Language.LSP.Protocol.Types.Lens where
4
5
Original file line number Diff line number Diff line change
1
+ {-# OPTIONS_GHC -Wno-orphans #-}
2
+ module Language.LSP.Protocol.Types.Orphans where
3
+
4
+ import Language.LSP.Protocol.Internal.Types
5
+ import Data.Default
6
+ import Data.Semigroup ()
7
+
8
+ instance Semigroup WorkspaceEdit where
9
+ (WorkspaceEdit a b c) <> (WorkspaceEdit a' b' c') = WorkspaceEdit (a <> a') (b <> b') (c <> c')
10
+ instance Monoid WorkspaceEdit where
11
+ mempty = WorkspaceEdit Nothing Nothing Nothing
12
+
13
+ instance Default ClientCapabilities where
14
+ def = ClientCapabilities def def def def def Nothing
15
+ instance Default WorkspaceClientCapabilities
16
+ instance Default TextDocumentClientCapabilities
17
+ instance Default NotebookDocumentClientCapabilities where
18
+ instance Default NotebookDocumentSyncClientCapabilities
19
+ instance Default WindowClientCapabilities
20
+ instance Default GeneralClientCapabilities
You can’t perform that action at this time.
0 commit comments