hsinspect-lsp 0.0.4 → 0.0.5
raw patch · 3 files changed
+8/−8 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- HsInspect.LSP.Impl: completionProvider :: Caches -> FilePath -> Text -> (Int, Int) -> ExceptT String IO [Text]
+ HsInspect.LSP.Impl: completionProvider :: Caches -> FilePath -> Text -> (Int, Int) -> ExceptT String IO [(Text, Maybe Text)]
Files
- exe/Main.hs +1/−1
- hsinspect-lsp.cabal +2/−2
- library/HsInspect/LSP/Impl.hs +5/−5
exe/Main.hs view
@@ -152,7 +152,7 @@ Core.sendFunc lf . RspCompletion $ Core.makeResponseMessage req none Right symbols -> do- let render txt = J.CompletionItem txt Nothing (J.List []) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing+ let render (txt, typInfo) = J.CompletionItem txt Nothing (J.List []) typInfo Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Core.sendFunc lf . RspCompletion $ Core.makeResponseMessage req (J.Completions . J.List $ render <$> symbols) Nothing -> do Core.sendFunc lf . RspCompletion $ Core.makeResponseMessage req none
hsinspect-lsp.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hsinspect-lsp-version: 0.0.4+version: 0.0.5 synopsis: LSP interface over the hsinspect binary. license: GPL-3.0-or-later license-file: LICENSE@@ -9,7 +9,7 @@ copyright: 2020 Tseen She tested-with: GHC ^>=8.4.4 || ^>=8.6.5 || ^>=8.8.3 category: Building-description: Inspect @.hs@ files using the ghc api.+description: Inspect @.hs@ files using the ghc api over LSP. source-repository head type: git
library/HsInspect/LSP/Impl.hs view
@@ -131,7 +131,7 @@ in (range,) <$> firstJust matcher symbols -- TODO use the index to add optional type information-completionProvider :: Caches -> FilePath -> Text -> (Int, Int) -> ExceptT String IO [Text]+completionProvider :: Caches -> FilePath -> Text -> (Int, Int) -> ExceptT String IO [(Text, Maybe Text)] completionProvider caches file contents position = do ctx <- cachedContext caches file symbols <- cachedImports caches ctx file@@ -140,13 +140,13 @@ pure $ case traceShow (found, symbols) found of Nothing -> [] Just (_, sym) -> do- let findNameAndType :: Text -> Import -> Text+ let findNameAndType :: Text -> Import -> (Text, Maybe Text) findNameAndType name imp = case findType (_full imp) index of- Just typ -> name <> " :: " <> typ- Nothing -> name+ Just typ -> (name, Just typ)+ Nothing -> (name, Nothing) - matcher :: (Import -> Maybe Text) -> Import -> Maybe Text+ matcher :: (Import -> Maybe Text) -> Import -> Maybe (Text, Maybe Text) matcher key imp = do pref <- key imp if T.isPrefixOf sym pref