Skip to content

Commit d61fe2c

Browse files
committed
move more
1 parent 874de7d commit d61fe2c

File tree

9 files changed

+52
-143
lines changed

9 files changed

+52
-143
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"hooks": [
55
{
66
"entry": "stylish-haskell --inplace",
7-
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/Compat/ExactPrint.hs$|^ghcide/src/Development/IDE/GHC/Compat/Core.hs$|^ghcide/src/Development/IDE/Spans/Pragmas.hs$|^ghcide/src/Development/IDE/LSP/Outline.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|^ghcide/src/Development/IDE/Core/Rules.hs$|^hls-test-utils/src/Test/Hls/Util.hs$|^ghcide/src/Development/IDE/Core/Compile.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs$)",
7+
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/Compat/ExactPrint.hs$|^ghcide/src/Development/IDE/GHC/Compat/Core.hs$|^ghcide/src/Development/IDE/Spans/Pragmas.hs$|^ghcide/src/Development/IDE/LSP/Outline.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|^ghcide/src/Development/IDE/Core/Rules.hs$|^hls-test-utils/src/Test/Hls/Util.hs$|^ghcide/src/Development/IDE/Core/Compile.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs$
8+
|^plugins/hls-core-plugin/Core/Outline.hs$)",
89
"files": "\\.l?hs$",
910
"id": "stylish-haskell",
1011
"language": "system",

ghcide/ghcide.cabal

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,8 @@ library
171171
Development.IDE.GHC.Util
172172
Development.IDE.Import.DependencyInformation
173173
Development.IDE.Import.FindImports
174-
Development.IDE.LSP.HoverDefinition
175174
Development.IDE.LSP.LanguageServer
176175
Development.IDE.LSP.Notifications
177-
Development.IDE.LSP.Outline
178176
Development.IDE.LSP.Server
179177
Development.IDE.Main
180178
Development.IDE.Main.HeapStats
@@ -386,7 +384,6 @@ test-suite ghcide-tests
386384
HieDbRetry
387385
HighlightTests
388386
IfaceTests
389-
InitializeResponseTests
390387
LogType
391388
NonLspCommandLine
392389
OpenCloseTest

ghcide/src/Development/IDE/Plugin/HLS/GhcIde.hs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ module Development.IDE.Plugin.HLS.GhcIde
99
) where
1010
import Control.Monad.IO.Class
1111
import Development.IDE
12-
import Development.IDE.LSP.HoverDefinition
13-
import qualified Development.IDE.LSP.Notifications as Notifications
14-
import Development.IDE.LSP.Outline
15-
import qualified Development.IDE.Plugin.Completions as Completions
16-
import qualified Development.IDE.Plugin.TypeLenses as TypeLenses
12+
import qualified Development.IDE.LSP.Notifications as Notifications
13+
import qualified Development.IDE.Plugin.Completions as Completions
14+
import qualified Development.IDE.Plugin.TypeLenses as TypeLenses
1715
import Ide.Types
1816
import Language.LSP.Protocol.Message
1917
import Language.LSP.Protocol.Types
20-
import Text.Regex.TDFA.Text ()
18+
import Text.Regex.TDFA.Text ()
2119

2220
data Log
2321
= LogNotifications Notifications.Log
@@ -43,24 +41,9 @@ descriptors recorder =
4341

4442
descriptor :: PluginId -> PluginDescriptor IdeState
4543
descriptor plId = (defaultPluginDescriptor plId desc)
46-
{ pluginHandlers = mkPluginHandler SMethod_TextDocumentHover hover'
47-
<> mkPluginHandler SMethod_TextDocumentDocumentSymbol moduleOutline
48-
<> mkPluginHandler SMethod_TextDocumentDefinition (\ide _ DefinitionParams{..} ->
49-
gotoDefinition ide TextDocumentPositionParams{..})
50-
<> mkPluginHandler SMethod_TextDocumentTypeDefinition (\ide _ TypeDefinitionParams{..} ->
51-
gotoTypeDefinition ide TextDocumentPositionParams{..})
52-
<> mkPluginHandler SMethod_TextDocumentDocumentHighlight (\ide _ DocumentHighlightParams{..} ->
53-
documentHighlight ide TextDocumentPositionParams{..})
54-
,
55-
56-
pluginConfigDescriptor = defaultConfigDescriptor
57-
}
44+
{ pluginConfigDescriptor = defaultConfigDescriptor }
5845
where
5946
desc = "Provides core IDE features for Haskell"
6047

6148
-- ---------------------------------------------------------------------
6249

63-
hover' :: PluginMethodHandler IdeState Method_TextDocumentHover
64-
hover' ideState _ HoverParams{..} = do
65-
liftIO $ logDebug (ideLogger ideState) "GhcIde.hover entered (ideLogger)" -- AZ
66-
hover ideState TextDocumentPositionParams{..}

ghcide/test/exe/InitializeResponseTests.hs

Lines changed: 0 additions & 97 deletions
This file was deleted.

ghcide/test/exe/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import Test.Tasty.Ingredients.Rerun
4747

4848
import LogType ()
4949
import OpenCloseTest
50-
import InitializeResponseTests
5150
import CompletionTests
5251
import CPPTests
5352
import DiagnosticTests
@@ -93,7 +92,6 @@ main = do
9392
-- We mess with env vars so run single-threaded.
9493
defaultMainWithRerun $ testGroup "ghcide"
9594
[ OpenCloseTest.tests
96-
, InitializeResponseTests.tests
9795
, CompletionTests.tests
9896
, CPPTests.tests
9997
, DiagnosticTests.tests

haskell-language-server.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,13 +1620,16 @@ library hls-core-plugin
16201620
exposed-modules:
16211621
Ide.Plugin.Core
16221622
Ide.Plugin.Core.Actions
1623+
Ide.Plugin.Core.HoverDefinition
1624+
Ide.Plugin.Core.Outline
16231625

16241626
hs-source-dirs: plugins/hls-core-plugin/src
16251627
build-depends:
16261628
, base >=4.12 && <5
16271629
, containers
16281630
, unordered-containers
16291631
, extra
1632+
, ghc
16301633
, text-rope
16311634
, mtl >= 2.2
16321635
, ghcide == 2.7.0.0

plugins/hls-core-plugin/src/Ide/Plugin/Core.hs

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
{-# LANGUAGE OverloadedStrings #-}
2+
{-# LANGUAGE RecordWildCards #-}
23

34

45
module Ide.Plugin.Core(descriptor, CoreLog) where
56

6-
import Control.Monad.IO.Class (liftIO)
7-
import Data.Maybe (fromMaybe)
8-
import Data.Text (Text)
9-
import qualified Data.Text as T
7+
import Control.Monad.IO.Class (liftIO)
8+
import Data.Maybe (fromMaybe)
9+
import Data.Text (Text)
10+
import qualified Data.Text as T
1011
import Development.IDE
11-
import qualified Development.IDE.Core.Shake as Shake
12-
import Ide.Plugin.Core.Actions (refsAtPoint, workspaceSymbols)
13-
import Ide.Plugin.Error (getNormalizedFilePathE)
12+
import qualified Development.IDE.Core.Shake as Shake
13+
import Ide.Plugin.Core.Actions (refsAtPoint, workspaceSymbols)
14+
import Ide.Plugin.Core.HoverDefinition
15+
import Ide.Plugin.Core.Outline (moduleOutline)
16+
import Ide.Plugin.Error (getNormalizedFilePathE)
1417
import Ide.Types
1518
import Language.LSP.Protocol.Message
16-
import Language.LSP.Protocol.Types (ReferenceParams (..),
17-
TextDocumentIdentifier (..),
18-
WorkspaceSymbolParams (..),
19-
type (|?) (InL))
19+
import Language.LSP.Protocol.Types (DefinitionParams (..),
20+
DocumentHighlightParams (..),
21+
HoverParams (..),
22+
ReferenceParams (..),
23+
TextDocumentIdentifier (..),
24+
TextDocumentPositionParams (..),
25+
TypeDefinitionParams (..),
26+
WorkspaceSymbolParams (..),
27+
type (|?) (InL))
2028

2129
data CoreLog
2230
= LogShake Shake.Log
@@ -34,7 +42,15 @@ descriptor recorder plId =
3442
(defaultPluginDescriptor plId "Provides core IDE features for Haskell")
3543
{
3644
Ide.Types.pluginHandlers =
37-
mkPluginHandler SMethod_WorkspaceSymbol (wsSymbols recorder)
45+
mkPluginHandler SMethod_TextDocumentDocumentSymbol moduleOutline
46+
<> mkPluginHandler SMethod_TextDocumentDefinition (\ide _ DefinitionParams{..} ->
47+
gotoDefinition ide TextDocumentPositionParams{..})
48+
<> mkPluginHandler SMethod_TextDocumentTypeDefinition (\ide _ TypeDefinitionParams{..} ->
49+
gotoTypeDefinition ide TextDocumentPositionParams{..})
50+
<> mkPluginHandler SMethod_TextDocumentDocumentHighlight (\ide _ DocumentHighlightParams{..} ->
51+
documentHighlight ide TextDocumentPositionParams{..})
52+
<> mkPluginHandler SMethod_TextDocumentHover hover'
53+
<> mkPluginHandler SMethod_WorkspaceSymbol (wsSymbols recorder)
3854
<> mkPluginHandler SMethod_TextDocumentReferences references
3955
}
4056

@@ -53,3 +69,9 @@ references ide _ (ReferenceParams (TextDocumentIdentifier uri) pos _ _ _) = do
5369
"References request at position " <> T.pack (showPosition pos) <>
5470
" in file: " <> T.pack (show nfp)
5571
InL <$> (liftIO $ runAction "references" ide $ refsAtPoint nfp pos)
72+
73+
74+
hover' :: PluginMethodHandler IdeState Method_TextDocumentHover
75+
hover' ideState _ HoverParams{..} = do
76+
liftIO $ logDebug (ideLogger ideState) "GhcIde.hover entered (ideLogger)" -- AZ
77+
hover ideState TextDocumentPositionParams{..}

ghcide/src/Development/IDE/LSP/HoverDefinition.hs renamed to plugins/hls-core-plugin/src/Ide/Plugin/Core/HoverDefinition.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
2-
-- SPDX-License-Identifier: Apache-2.0
3-
{-# LANGUAGE GADTs #-}
1+
{-# LANGUAGE GADTs #-}
2+
{-# LANGUAGE OverloadedStrings #-}
43

54
-- | Display information on hover.
6-
module Development.IDE.LSP.HoverDefinition
5+
module Ide.Plugin.Core.HoverDefinition
76
(
87
-- * For haskell-language-server
98
hover

ghcide/src/Development/IDE/LSP/Outline.hs renamed to plugins/hls-core-plugin/src/Ide/Plugin/Core/Outline.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{-# LANGUAGE CPP #-}
2-
32
{-# LANGUAGE DuplicateRecordFields #-}
3+
{-# LANGUAGE LambdaCase #-}
44
{-# LANGUAGE GADTs #-}
5+
{-# LANGUAGE RecordWildCards #-}
6+
{-# LANGUAGE ViewPatterns #-}
7+
{-# LANGUAGE OverloadedStrings #-}
58

6-
module Development.IDE.LSP.Outline
9+
module Ide.Plugin.Core.Outline
710
( moduleOutline
811
)
912
where

0 commit comments

Comments
 (0)