Complete migration of some utilities to haskell-lsp

Currently using submodules pending accepting PRs on haskell-lsp and
lsp-test
This commit is contained in:
Alan Zimmerman 2019-05-07 23:06:48 +02:00
parent 3ee785a779
commit 4e76c92e73
20 changed files with 77 additions and 89 deletions

6
.gitmodules vendored
View File

@ -31,3 +31,9 @@
# url = https://github.com/bubba/ghc-mod.git
url = https://github.com/alanz/ghc-mod.git
[submodule "submodules/haskell-lsp"]
path = submodules/haskell-lsp
url = https://github.com/alanz/haskell-lsp.git
[submodule "submodules/lsp-test"]
path = submodules/lsp-test
url = https://github.com/alanz/lsp-test.git

View File

@ -8,5 +8,8 @@ packages:
./submodules/ghc-mod/
./submodules/ghc-mod/core/
./submodules/ghc-mod/ghc-project-types
./submodules/haskell-lsp
./submodules/haskell-lsp/haskell-lsp-types
./submodules/lsp-test
tests: true

View File

@ -86,7 +86,7 @@ library
, optparse-simple >= 0.0.3
, parsec
, process
, rope-utf16-splay
, rope-utf16-splay >= 0.3.1.0
, safe
, sorted-list >= 0.2.1.0
, stm

View File

@ -32,7 +32,6 @@ module Haskell.Ide.Engine.PluginUtils
, readVFS
, getRangeFromVFS
, rangeLinesFromVfs
, splitAtLine
) where
import Control.Monad.IO.Class
@ -286,11 +285,4 @@ getRangeFromVFS uri rg = do
Just vfs -> return $ Just $ rangeLinesFromVfs vfs rg
Nothing -> return Nothing
-- rangeLinesFromVfs :: VirtualFile -> Range -> T.Text
-- rangeLinesFromVfs (VirtualFile _ yitext _) (Range (Position lf _cf) (Position lt _ct)) = r
-- where
-- (_ ,s1) = splitAtLine lf yitext
-- (s2, _) = splitAtLine (lt - lf) s1
-- r = Rope.toText s2
-- ---------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ library
, hslogger
, monad-control
, mtl
, rope-utf16-splay == 0.2.*
, rope-utf16-splay >= 0.3.1.0
, stm
, syb
, text

View File

@ -189,24 +189,6 @@ safeTyThingId _ = Nothing
-- Associates a module's qualifier with its members
type QualCompls = Map.Map T.Text [CompItem]
-- -- | Describes the line at the current cursor position
-- data PosPrefixInfo = PosPrefixInfo
-- { fullLine :: T.Text
-- -- ^ The full contents of the line the cursor is at
-- , prefixModule :: T.Text
-- -- ^ If any, the module name that was typed right before the cursor position.
-- -- For example, if the user has typed "Data.Maybe.from", then this property
-- -- will be "Data.Maybe"
-- , prefixText :: T.Text
-- -- ^ The word right before the cursor position, after removing the module part.
-- -- For example if the user has typed "Data.Maybe.from",
-- -- then this property will be "from"
-- , cursorPos :: J.Position
-- -- ^ The cursor position
-- }
data CachedCompletions = CC
{ allModNamesAsNS :: [T.Text]
, unqualCompls :: [CompItem]

View File

@ -27,7 +27,6 @@ import Control.Monad.STM
import Data.Aeson ( (.=) )
import qualified Data.Aeson as J
import qualified Data.ByteString.Lazy as BL
-- import Data.Char (isUpper, isAlphaNum)
import Data.Coerce (coerce)
import Data.Default
import Data.Foldable
@ -203,33 +202,6 @@ getPrefixAtPos :: (MonadIO m, MonadReader REnv m)
getPrefixAtPos uri pos = do
mvf <- liftIO =<< asksLspFuncs Core.getVirtualFileFunc <*> pure uri
case mvf of
-- Just (VFS.VirtualFile _ yitext) ->
-- return $ Just $ fromMaybe (Hie.PosPrefixInfo "" "" "" pos) $ do
-- let headMaybe [] = Nothing
-- headMaybe (x:_) = Just x
-- lastMaybe [] = Nothing
-- lastMaybe xs = Just $ last xs
-- -- curLine <- headMaybe $ Yi.lines $ snd $ Yi.splitAtLine l yitext
-- -- let beforePos = Yi.take c curLine
-- -- curWord <- case Yi.last beforePos of
-- -- Just ' ' -> Just "" -- don't count abc as the curword in 'abc '
-- -- _ -> Yi.toText <$> lastMaybe (Yi.words beforePos)
-- curLine <- headMaybe $ Yi.lines $ snd $ splitAtLine l yitext
-- let beforePos = Yi.take c curLine
-- curWord <- case Yi.last beforePos of
-- Just ' ' -> Just "" -- don't count abc as the curword in 'abc '
-- _ -> Yi.toText <$> lastMaybe (Yi.words beforePos)
-- let parts = T.split (=='.')
-- $ T.takeWhileEnd (\x -> isAlphaNum x || x `elem` ("._'"::String)) curWord
-- case reverse parts of
-- [] -> Nothing
-- (x:xs) -> do
-- let modParts = dropWhile (not . isUpper . T.head)
-- $ reverse $ filter (not .T.null) xs
-- modName = T.intercalate "." modParts
-- return $ Hie.PosPrefixInfo (Yi.toText curLine) modName x pos
Just vf -> VFS.getCompletionPrefix pos vf
Nothing -> return Nothing

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
# - brittany-0.11.0.0
- butcher-1.3.1.1
@ -20,11 +23,11 @@ extra-deps:
- ghc-exactprint-0.5.8.2
- haddock-api-2.18.1
- haddock-library-1.4.4
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- hlint-2.0.11
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- mtl-2.2.2
- pretty-show-1.8.2

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
# - brittany-0.11.0.0
- butcher-1.3.1.1
@ -21,14 +24,14 @@ extra-deps:
- ghc-exactprint-0.5.8.2
- haddock-api-2.18.1
- haddock-library-1.4.4
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- pretty-show-1.8.2
- sorted-list-0.2.1.0

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
# - brittany-0.11.0.0
- base-compat-0.9.3
@ -19,14 +22,14 @@ extra-deps:
- ghc-exactprint-0.5.8.2
- haddock-api-2.20.0
- haddock-library-1.6.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- pretty-show-1.8.2
- syz-0.2.0.0

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- base-compat-0.9.3
- cabal-plan-0.3.0.0
@ -18,14 +21,14 @@ extra-deps:
- ghc-exactprint-0.5.8.2
- haddock-api-2.20.0
- haddock-library-1.6.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- pretty-show-1.8.2
- syz-0.2.0.0

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
# - brittany-0.11.0.0
- cabal-plan-0.4.0.0
@ -18,14 +21,14 @@ extra-deps:
- ghc-exactprint-0.5.8.2
- haddock-api-2.20.0
- haddock-library-1.6.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- optparse-simple-0.1.0
- pretty-show-1.9.5

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- apply-refact-0.6.0.0
- butcher-1.3.2.1
@ -20,14 +23,14 @@ extra-deps:
- data-tree-print-0.1.0.2
- floskell-0.10.0
- haddock-api-2.21.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- monad-memo-0.4.1
- monoid-subclasses-0.4.6.1

View File

@ -10,20 +10,23 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- butcher-1.3.2.1
- cabal-plan-0.4.0.0
- constrained-dynamic-0.1.0.0
- floskell-0.10.0
- haddock-api-2.21.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- monad-memo-0.4.1
- multistate-0.8.0.1

View File

@ -10,20 +10,23 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- butcher-1.3.2.1
- cabal-plan-0.4.0.0
- constrained-dynamic-0.1.0.0
- floskell-0.10.0
- haddock-api-2.21.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- haskell-src-exts-util-0.2.5
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2
- monad-memo-0.4.1
- multistate-0.8.0.1

View File

@ -10,19 +10,22 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- butcher-1.3.2.1
- cabal-plan-0.4.0.0
- constrained-dynamic-0.1.0.0
- floskell-0.10.0
- haddock-api-2.22.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- haskell-src-exts-1.21.0
- hlint-2.1.17
- hoogle-5.0.17.6
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2@rev:1
- monad-memo-0.4.1
- multistate-0.8.0.1

View File

@ -10,6 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- ansi-terminal-0.8.2
- butcher-1.3.2.1
@ -19,11 +22,11 @@ extra-deps:
- floskell-0.10.0
- ghc-exactprint-0.5.8.2
- haddock-api-2.22.0
- haskell-lsp-0.11.0.0
- haskell-lsp-types-0.11.0.0
# - haskell-lsp-0.12.1.0
# - haskell-lsp-types-0.12.1.0
- hlint-2.1.17
- hsimport-0.8.8
- lsp-test-0.5.2.0
# - lsp-test-0.5.2.1
- monad-dijkstra-0.1.1.2@rev:1
- monad-memo-0.4.1
- multistate-0.8.0.1

View File

@ -10,9 +10,9 @@ extra-deps:
- ./submodules/ghc-mod
- ./submodules/ghc-mod/core
- ./submodules/ghc-mod/ghc-project-types
- ../lsp-test
- ../haskell-lsp
- ../haskell-lsp/haskell-lsp-types
- ./submodules/haskell-lsp
- ./submodules/haskell-lsp/haskell-lsp-types
- ./submodules/lsp-test
- ansi-terminal-0.8.2
- butcher-1.3.2.1
@ -30,6 +30,7 @@ extra-deps:
- monad-dijkstra-0.1.1.2@rev:1
- monad-memo-0.4.1
- multistate-0.8.0.1
- rope-utf16-splay-0.3.1.0
- syz-0.2.0.0
- temporary-1.2.1.1
- yaml-0.8.32

@ -0,0 +1 @@
Subproject commit 8cae6484aeeebc01112b7059cddc57b35ae8c081

1
submodules/lsp-test Submodule

@ -0,0 +1 @@
Subproject commit d54524be6dd2b0b2d20530afd7049f22b33129d5