[LIGO-40] Move LSP request handlers to Capabilities directory
This commit is contained in:
parent
0b1590e324
commit
7c43cd9574
@ -1,9 +1,7 @@
|
|||||||
-- | The "all things AST"-module.
|
-- | The "all things AST"-module.
|
||||||
module AST (module M) where
|
module AST (module M) where
|
||||||
|
|
||||||
import AST.Completion as M
|
import AST.Capabilities as M
|
||||||
import AST.Find as M
|
|
||||||
import AST.Folding as M
|
|
||||||
import AST.Parser as M
|
import AST.Parser as M
|
||||||
import AST.Scope as M
|
import AST.Scope as M
|
||||||
import AST.Skeleton as M
|
import AST.Skeleton as M
|
||||||
|
7
tools/lsp/squirrel/src/AST/Capabilities.hs
Normal file
7
tools/lsp/squirrel/src/AST/Capabilities.hs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- | Module that exports all capabilities.
|
||||||
|
module AST.Capabilities (module Exports) where
|
||||||
|
|
||||||
|
import AST.Capabilities.Completion as Exports
|
||||||
|
import AST.Capabilities.Find as Exports
|
||||||
|
import AST.Capabilities.Folding as Exports
|
||||||
|
import AST.Capabilities.Hover as Exports
|
@ -1,6 +1,4 @@
|
|||||||
{-# LANGUAGE RecordWildCards #-}
|
module AST.Capabilities.Completion where
|
||||||
|
|
||||||
module AST.Completion where
|
|
||||||
|
|
||||||
import Language.Haskell.LSP.Types (CompletionDoc (..), CompletionItem (..), CompletionItemKind (..))
|
import Language.Haskell.LSP.Types (CompletionDoc (..), CompletionItem (..), CompletionItemKind (..))
|
||||||
|
|
||||||
@ -49,7 +47,11 @@ complete r tree = do
|
|||||||
$ scope
|
$ scope
|
||||||
|
|
||||||
toCompletionItem :: Completion -> CompletionItem
|
toCompletionItem :: Completion -> CompletionItem
|
||||||
toCompletionItem c@Completion{..} = CompletionItem
|
toCompletionItem c@Completion
|
||||||
|
{ cName = cName
|
||||||
|
, cType = cType
|
||||||
|
, cDoc = _cDoc
|
||||||
|
} = CompletionItem
|
||||||
{ _label = cName
|
{ _label = cName
|
||||||
, _kind = Just $ CiFunction -- TODO
|
, _kind = Just $ CiFunction -- TODO
|
||||||
, _detail = Just $ ":: " <> cType -- TODO: more elaborate info
|
, _detail = Just $ ":: " <> cType -- TODO: more elaborate info
|
||||||
@ -68,7 +70,11 @@ toCompletionItem c@Completion{..} = CompletionItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
mkDoc :: Completion -> CompletionDoc
|
mkDoc :: Completion -> CompletionDoc
|
||||||
mkDoc Completion {..} = CompletionDocString $
|
mkDoc Completion
|
||||||
|
{ cName = cName
|
||||||
|
, cType = cType
|
||||||
|
, cDoc = cDoc
|
||||||
|
} = CompletionDocString $
|
||||||
cName <> " is of type " <> cType <> ". " <> cDoc
|
cName <> " is of type " <> cType <> ". " <> cDoc
|
||||||
|
|
||||||
asCompletion :: ScopedDecl -> Completion
|
asCompletion :: ScopedDecl -> Completion
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
module AST.Find where
|
module AST.Capabilities.Find where
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
-- | Code folding utilities
|
-- | Code folding utilities
|
||||||
|
|
||||||
module AST.Folding where
|
module AST.Capabilities.Folding where
|
||||||
|
|
||||||
import qualified Language.Haskell.LSP.Types as J
|
import qualified Language.Haskell.LSP.Types as J
|
||||||
|
|
@ -13,7 +13,7 @@ import AST.Skeleton
|
|||||||
import Duplo.Pretty
|
import Duplo.Pretty
|
||||||
import Product
|
import Product
|
||||||
import Range
|
import Range
|
||||||
import Data.Text (intercalate)
|
import Data.Text (pack, intercalate)
|
||||||
|
|
||||||
hoverDecl
|
hoverDecl
|
||||||
:: CanSearch xs
|
:: CanSearch xs
|
||||||
@ -32,7 +32,7 @@ mkContents ScopedDecl
|
|||||||
{ _sdType = ppToText -> _sdType
|
{ _sdType = ppToText -> _sdType
|
||||||
, _sdName = ppToText -> _sdName
|
, _sdName = ppToText -> _sdName
|
||||||
, _sdDoc = ppToText -> _sdDoc
|
, _sdDoc = ppToText -> _sdDoc
|
||||||
, _sdOrigin = ppToText -> _sdOrigin
|
, _sdOrigin = pack . show -> _sdOrigin
|
||||||
-- TODO: more documentation
|
-- TODO: more documentation
|
||||||
} = LSP.HoverContents $ LSP.MarkupContent
|
} = LSP.HoverContents $ LSP.MarkupContent
|
||||||
{ _kind = LSP.MkMarkdown
|
{ _kind = LSP.MkMarkdown
|
||||||
|
Loading…
Reference in New Issue
Block a user