File tree 5 files changed +17
-9
lines changed
src/Development/IDE/Plugin
5 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import Ide.Plugin.Example as Example
10
10
import Ide.Plugin.Example2 as Example2
11
11
import Development.IDE (IdeState )
12
12
import Development.IDE.Plugin.HLS.GhcIde as GhcIde
13
+ import Development.IDE.Plugin.Completions as Completions
13
14
import Development.IDE.Plugin.TypeLenses as TypeLenses
14
15
15
16
-- haskell-language-server optional plugins
@@ -92,6 +93,7 @@ idePlugins includeExamples = pluginDescToIdePlugins allPlugins
92
93
basePlugins =
93
94
[ GhcIde. descriptor " ghcide"
94
95
, TypeLenses. descriptor " type-lenses"
96
+ , Completions. descriptor " completions"
95
97
#if pragmas
96
98
, Pragmas. descriptor " pragmas"
97
99
#endif
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import Development.IDE.Types.Diagnostics
28
28
import Development.IDE.Types.Options
29
29
import Development.IDE.Types.Logger
30
30
import Development.IDE.Plugin
31
+ import Development.IDE.Plugin.Completions as Completions
31
32
import Development.IDE.Plugin.TypeLenses as TypeLenses
32
33
import Development.IDE.Plugin.Test as Test
33
34
import Development.IDE.Session (loadSession )
@@ -91,6 +92,7 @@ main = do
91
92
let hlsPlugins = pluginDescToIdePlugins $
92
93
[ GhcIde. descriptor " ghcide"
93
94
, TypeLenses. descriptor " type-lenses"
95
+ , Completions. descriptor " ghcide-completions"
94
96
] ++
95
97
[ Test. blockCommandDescriptor " block-command" | argsTesting]
96
98
Original file line number Diff line number Diff line change 3
3
#include "ghc-api-version.h"
4
4
5
5
module Development.IDE.Plugin.Completions
6
- (
7
- produceCompletions
8
- , getCompletionsLSP
6
+ ( descriptor
7
+ , ProduceCompletions (.. )
8
+ , LocalCompletions (.. )
9
+ , NonLocalCompletions (.. )
9
10
) where
10
11
import Language.Haskell.LSP.Types
11
12
import qualified Language.Haskell.LSP.Core as LSP
@@ -27,6 +28,13 @@ import TcRnDriver (tcRnImportDecls)
27
28
import Data.Maybe
28
29
import Ide.Plugin.Config (Config (completionSnippetsOn ))
29
30
import Ide.PluginUtils (getClientConfig )
31
+ import Ide.Types
32
+
33
+ descriptor :: PluginId -> PluginDescriptor IdeState
34
+ descriptor plId = (defaultPluginDescriptor plId)
35
+ { pluginRules = produceCompletions
36
+ , pluginCompletionProvider = Just getCompletionsLSP
37
+ }
30
38
31
39
#if defined(GHC_LIB)
32
40
import Development.IDE.Import.DependencyInformation
Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ import Development.IDE.GHC.Util
49
49
import Outputable (Outputable )
50
50
import qualified Data.Set as Set
51
51
import ConLike
52
-
53
52
import GhcPlugins (
54
53
flLabel ,
55
54
unpackFS )
56
55
import Data.Either (fromRight )
56
+ import Ide.Types (WithSnippets (.. ))
57
57
58
58
-- From haskell-ide-engine/hie-plugin-api/Haskell/Ide/Engine/Context.hs
59
59
@@ -443,8 +443,6 @@ findRecordCompl _ _ _ = []
443
443
ppr :: Outputable a => a -> T. Text
444
444
ppr = T. pack . prettyPrint
445
445
446
- newtype WithSnippets = WithSnippets Bool
447
-
448
446
toggleSnippets :: ClientCapabilities -> WithSnippets -> CompletionItem -> CompletionItem
449
447
toggleSnippets ClientCapabilities { _textDocument } (WithSnippets with) x
450
448
| with && supported = x
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ module Development.IDE.Plugin.HLS.GhcIde
7
7
descriptor
8
8
) where
9
9
import Development.IDE
10
- import Development.IDE.Plugin.Completions as Completions
11
10
import Development.IDE.Plugin.CodeAction as CodeAction
12
11
import Development.IDE.LSP.HoverDefinition
13
12
import Development.IDE.LSP.Outline
@@ -23,8 +22,7 @@ descriptor plId = (defaultPluginDescriptor plId)
23
22
{ pluginCodeActionProvider = Just codeAction'
24
23
, pluginHoverProvider = Just hover'
25
24
, pluginSymbolsProvider = Just symbolsProvider
26
- , pluginCompletionProvider = Just getCompletionsLSP
27
- , pluginRules = produceCompletions <> rulePackageExports
25
+ , pluginRules = rulePackageExports
28
26
}
29
27
30
28
-- ---------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments