packages feed

dhall-lsp-server 1.1.0 → 1.1.1

raw patch · 2 files changed

+21/−18 lines, 2 filesdep ~aesondep ~hspecdep ~lsp

Dependency ranges changed: aeson, hspec, lsp, lsp-types, rope-utf16-splay, text

Files

dhall-lsp-server.cabal view
@@ -1,5 +1,5 @@ name:           dhall-lsp-server-Version:        1.1.0+Version:        1.1.1 cabal-version:  1.12 synopsis:       Language Server Protocol (LSP) server for Dhall homepage:       https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server#readme@@ -42,7 +42,7 @@       src   default-extensions: RecordWildCards OverloadedStrings   build-depends:-      aeson                >= 1.3.1.1  && < 1.6+      aeson                >= 1.3.1.1  && < 2.1     , aeson-pretty         >= 0.8.7    && < 0.9     , base                 >= 4.11     && < 5     , bytestring           >= 0.10.8.2 && < 0.12@@ -103,7 +103,7 @@     Main-Is: Main.hs     GHC-Options: -Wall     Build-Depends:-        base                                   ,+        base                                    ,         lsp-types         >= 1.2.0.0  && < 1.5  ,         hspec             >= 2.7      && < 2.10 ,         lsp-test          >= 0.13.0.0 && < 0.15 ,
src/Dhall/LSP/Handlers.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE DataKinds      #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE MultiWayIf     #-}+{-# LANGUAGE ViewPatterns   #-}  module Dhall.LSP.Handlers where @@ -125,14 +126,16 @@ -- helper rangeToJSON :: Range -> LSP.Types.Range rangeToJSON (Range (x1,y1) (x2,y2)) =-    LSP.Types.Range (Position x1 y1) (Position x2 y2)+    LSP.Types.Range+      (Position (fromIntegral x1) (fromIntegral y1))+      (Position (fromIntegral x2) (fromIntegral y2))  hoverHandler :: Handlers HandlerM hoverHandler =     LSP.requestHandler STextDocumentHover \request respond -> do         let uri_ = request^.params.textDocument.uri -        let Position{ _line, _character } = request^.params.position+        let Position{ _line = fromIntegral -> _line, _character = fromIntegral -> _character } = request^.params.position          errorMap <- use errors @@ -301,7 +304,7 @@          ServerConfig{..} <- liftLSP LSP.getConfig -        let numLines = Text.length txt+        let numLines = fromIntegral (Text.length txt)         let _newText= formatExprWithHeader chosenCharacterSet expr header         let _range = LSP.Types.Range (Position 0 0) (Position numLines 0) @@ -353,7 +356,7 @@    ServerConfig{..} <- liftLSP LSP.getConfig -  let numLines = Text.length txt+  let numLines = fromIntegral (Text.length txt)    let _newText = formatExprWithHeader chosenCharacterSet (lint expr) header @@ -380,8 +383,8 @@ executeAnnotateLet request = do   args <- getCommandArguments request :: HandlerM TextDocumentPositionParams   let uri_ = args ^. textDocument . uri-      line_ = args ^. position . line-      col_ = args ^. position . character+      line_ = fromIntegral (args ^. position . line)+      col_ = fromIntegral (args ^. position . character)    expr <- loadFile uri_   (welltyped, _) <- case typecheck expr of@@ -395,8 +398,8 @@       Right x -> return x       Left msg -> throwE (Warning, Text.pack msg) -  let _range = LSP.Types.Range (Position (unPos x1 - 1) (unPos y1 - 1))-                      (Position (unPos x2 - 1) (unPos y2 - 1))+  let _range = LSP.Types.Range (Position (fromIntegral (unPos x1 - 1)) (fromIntegral (unPos y1 - 1)))+                      (Position (fromIntegral (unPos x2 - 1)) (fromIntegral (unPos y2 - 1)))    let _newText= formatExpr chosenCharacterSet annotExpr @@ -435,7 +438,7 @@       Left _ -> throwE (Error, "Could not freeze import; failed to evaluate import.")     assign importCache cache' -    let _range = LSP.Types.Range (Position x1 y1) (Position x2 y2)+    let _range = LSP.Types.Range (Position (fromIntegral x1) (fromIntegral y1)) (Position (fromIntegral x2) (fromIntegral y2))     let _newText = " " <> hash     return TextEdit{..} @@ -457,8 +460,8 @@ executeFreezeImport request = do   args <- getCommandArguments request :: HandlerM TextDocumentPositionParams   let uri_  = args ^. textDocument . uri-  let line_ = args ^. position . line-  let col_  = args ^. position . character+  let line_ = fromIntegral (args ^. position . line)+  let col_  = fromIntegral (args ^. position . character)    txt <- readUri uri_   expr <- case parse txt of@@ -484,7 +487,7 @@     Left _ -> throwE (Error, "Could not freeze import; failed to evaluate import.")   assign importCache cache' -  let _range = LSP.Types.Range (Position x1 y1) (Position x2 y2)+  let _range = LSP.Types.Range (Position (fromIntegral x1) (fromIntegral y1)) (Position (fromIntegral x2) (fromIntegral y2))   let _newText = " " <> hash    let _edit = WorkspaceEdit@@ -502,9 +505,9 @@ completionHandler :: Handlers HandlerM completionHandler =   LSP.requestHandler STextDocumentCompletion \request respond -> do-    let uri_ = request ^. params . textDocument . uri-        line_ = request ^. params . position . line-        col_ = request ^. params . position . character+    let uri_  = request ^. params . textDocument . uri+        line_ = fromIntegral (request ^. params . position . line)+        col_  = fromIntegral (request ^. params . position . character)      txt <- readUri uri_     let (completionLeadup, completionPrefix) = completionQueryAt txt (line_, col_)