packages feed

hls-plugin-api 0.6.0.0 → 0.7.0.0

raw patch · 4 files changed

+22/−8 lines, 4 filesdep ~haskell-lspPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: haskell-lsp

API changes (from Hackage documentation)

+ Ide.Plugin.Config: [maxCompletions] :: Config -> !Int
+ Ide.PluginUtils: subRange :: Range -> Range -> Bool
- Ide.Plugin.Config: Config :: CheckParents -> !Bool -> !Bool -> !Bool -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Text -> !Map Text PluginConfig -> Config
+ Ide.Plugin.Config: Config :: CheckParents -> !Bool -> !Bool -> !Bool -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Text -> !Int -> !Map Text PluginConfig -> Config

Files

hls-plugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2
 name:          hls-plugin-api
-version:       0.6.0.0
+version:       0.7.0.0
 synopsis:      Haskell Language Server API for plugin communication
 description:
   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
@@ -8,10 +8,10 @@ bug-reports:   https://github.com/haskell/haskell-language-server/issues
 license:       Apache-2.0
 license-file:  LICENSE
-author:        Many,TBD when we release
-maintainer:    alan.zimm@gmail.com (for now)
-copyright:     Alan Zimmerman
-category:      Web
+author:        The Haskell IDE Team
+maintainer:    alan.zimm@gmail.com
+copyright:     The Haskell IDE Team
+category:      Development
 build-type:    Simple
 
 flag pedantic
@@ -37,7 +37,7 @@     , containers
     , data-default
     , Diff
-    , haskell-lsp           ^>=0.22
+    , haskell-lsp           ^>=0.23
     , hashable
     , hslogger
     , lens
src/Ide/Plugin/Config.hs view
@@ -69,6 +69,7 @@     , completionSnippetsOn        :: !Bool
     , formatOnImportOn            :: !Bool
     , formattingProvider          :: !T.Text
+    , maxCompletions              :: !Int
     , plugins                     :: !(Map.Map T.Text PluginConfig)
     } deriving (Show,Eq)
 
@@ -87,6 +88,7 @@     , formattingProvider          = "ormolu"
     -- , formattingProvider          = "floskell"
     -- , formattingProvider          = "stylish-haskell"
+    , maxCompletions              = 40
     , plugins                     = Map.empty
     }
 
@@ -107,6 +109,7 @@       <*> o .:? "completionSnippetsOn"                    .!= completionSnippetsOn def
       <*> o .:? "formatOnImportOn"                        .!= formatOnImportOn def
       <*> o .:? "formattingProvider"                      .!= formattingProvider def
+      <*> o .:? "maxCompletions"                          .!= maxCompletions def
       <*> o .:? "plugin"                                  .!= plugins def
 
 -- 2017-10-09 23:22:00.710515298 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"haskell":{"maxNumberOfProblems":100,"hlintOn":true}}}}
src/Ide/PluginUtils.hs view
@@ -18,7 +18,7 @@     fullRange,
     mkLspCommand,
     mkLspCmdId,
-  allLspCmdIds,allLspCmdIds',installSigUsr1Handler)
+  allLspCmdIds,allLspCmdIds',installSigUsr1Handler, subRange)
 where
 
 
@@ -210,6 +210,18 @@         the start of the next line"
         -}
         lastLine = length $ T.lines s
+
+subRange :: Range -> Range -> Bool
+subRange smallRange range =
+     positionInRange (_start smallRange) range
+  && positionInRange (_end smallRange) range
+
+positionInRange :: Position -> Range -> Bool
+positionInRange (Position pl po) (Range (Position sl so) (Position el eo)) =
+     pl >  sl && pl <  el
+  || pl == sl && pl == el && po >= so && po <= eo
+  || pl == sl && po >= so
+  || pl == el && po <= eo
 
 -- ---------------------------------------------------------------------
 
src/Ide/Types.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE GADTs #-}
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 
 module Ide.Types