Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lsp-types/src/Language/LSP/Types/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Language.LSP.Types.Common (
import Control.Applicative
import Control.DeepSeq
import Data.Aeson
import Data.Hashable
import Data.Int (Int32)
import Data.Mod.Word
import Text.Read (Read(readPrec))
Expand All @@ -33,6 +34,8 @@ newtype UInt = UInt (Mod (2^31))
deriving stock (Generic)
deriving anyclass (NFData)

instance Hashable UInt where hashWithSalt s (UInt n) = hashWithSalt s (unMod n)

instance Show UInt where
show (UInt u) = show $ unMod u

Expand Down
7 changes: 7 additions & 0 deletions lsp-types/src/Language/LSP/Types/Location.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Language.LSP.Types.Location where

import Control.DeepSeq
import Data.Aeson.TH
import Data.Hashable
import GHC.Generics hiding (UInt)
import Language.LSP.Types.Common
import Language.LSP.Types.Uri
Expand All @@ -26,6 +27,8 @@ data Position =
instance NFData Position
deriveJSON lspOptions ''Position

instance Hashable Position

-- ---------------------------------------------------------------------

data Range =
Expand All @@ -37,6 +40,8 @@ data Range =
instance NFData Range
deriveJSON lspOptions ''Range

instance Hashable Range

-- ---------------------------------------------------------------------

data Location =
Expand All @@ -48,6 +53,8 @@ data Location =
instance NFData Location
deriveJSON lspOptions ''Location

instance Hashable Location

-- ---------------------------------------------------------------------

-- | Represents a link between a source and a target location.
Expand Down