File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
lsp-types/src/Language/LSP/Types Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module Language.LSP.Types.Common (
1818import Control.Applicative
1919import Control.DeepSeq
2020import Data.Aeson
21+ import Data.Hashable
2122import Data.Int (Int32 )
2223import Data.Mod.Word
2324import Text.Read (Read (readPrec ))
@@ -33,6 +34,8 @@ newtype UInt = UInt (Mod (2^31))
3334 deriving stock (Generic )
3435 deriving anyclass (NFData )
3536
37+ instance Hashable UInt where hashWithSalt s (UInt n) = hashWithSalt s (unMod n)
38+
3639instance Show UInt where
3740 show (UInt u) = show $ unMod u
3841
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Language.LSP.Types.Location where
44
55import Control.DeepSeq
66import Data.Aeson.TH
7+ import Data.Hashable
78import GHC.Generics hiding (UInt )
89import Language.LSP.Types.Common
910import Language.LSP.Types.Uri
@@ -26,6 +27,8 @@ data Position =
2627instance NFData Position
2728deriveJSON lspOptions ''Position
2829
30+ instance Hashable Position
31+
2932-- ---------------------------------------------------------------------
3033
3134data Range =
@@ -37,6 +40,8 @@ data Range =
3740instance NFData Range
3841deriveJSON lspOptions ''Range
3942
43+ instance Hashable Range
44+
4045-- ---------------------------------------------------------------------
4146
4247data Location =
@@ -48,6 +53,8 @@ data Location =
4853instance NFData Location
4954deriveJSON lspOptions ''Location
5055
56+ instance Hashable Location
57+
5158-- ---------------------------------------------------------------------
5259
5360-- | Represents a link between a source and a target location.
You can’t perform that action at this time.
0 commit comments